I've been working a little bit on a Facebook application, but when I registered a new user to test the friend interaction the new user got a uid (100000XXXXXXXXX
) that seems to big for php to handle.
Saving the number in the database results in the same value (2147483647
). I'm guessing this is also PHPs fault, as I would believe the uid would fit in an unsigned bigint?
I'm not quite sure where to go from here, any suggestions?
The fix is to store the UID as a string always. Use the VARCHAR
field type in MySQL and you will be fine.
In general, many database gurus will tell you that interpreting another application's foreign keys (like UID in this case) is bad bad bad and you should handle them as opaque text.
Facebook recommonds to store it as a BIGINT unsigned.
User
object details and connections can be found here.
For PHP, you'd store it as a string (because, ultimately, if you're going to use it, it's going to be displayed on the page or in JSON data or something else that's stringy. There's no real need to perform arithmetic on that number).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With