vipmaa's avatar

FbId bigint with Model and Eloquent

I have created project with facebook authontication , so the user id in the project is fbid and the length is 17 this mean data type bigint. first i'm using OS Ubuntu , my team using Win 10 and we use https://github.com/barryvdh/laravel-debugbar for debugging in Ubuntu every thing Ok, But Windows not working properly when i use the Eloqunt to get the data i facing 3 issues

  • some time fbid revert as int Max "2147483647"
  • when i use join or hasMay the query execute properly but can't merge it ( i see in debugger 2 queries for user and posts)
  • for fbid 10153262671266093 it is convert to 10153262671266092 after time of searching i got idea to cast the fbid as string and it is work now

i want to share it and discuss about this issue

0 likes
3 replies
SaeedPrez's avatar

@vipmaa I'm also working with big integers at the moment and it is a pain.

From my understanding, PHP_INT_MAX depends on your platform, so if you're on 32 bit hardware or 32 bit OS or 32 bit compile of PHP, the integer is stored in 4 bytes (max ~2 billion). However, if all three are 64-bit, you get the larger 8 bytes integer.

1 like
Prullenbak's avatar

In my former job, I made a lot of small apps with facebook connections, and always used a string for the facebook id.

1 like
SaeedPrez's avatar

I wasted half a day yesterday trying to come up with solutions to use big integers in my project (not Facebook related). I don't know why, but I was using XAMPP on Windows 10 which runs 32-bit version.

I finally got off my butt and installed Homestead for the first time - took me about 30 min to download, install & configure - now I have a much better environment and dd(PHP_INT_MAX) gives me 9223372036854775807

1 like

Please or to participate in this conversation.