- Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
Unpacking 64-bit unsigned integer will result in a negative value if the value is bigger than 2^63 (as PHP does not support unsigned integers):
php > var_dump(msgpack_unpack("\xcf"."\xff\xff\xff\xff"."\xff\xff\xff\xff")); int(-1)But PHP's behavior in such cases is to fall back to float/double:
If PHP encounters a number beyond the bounds of the integer type, it will be interpreted as a float instead. Also, an operation which results in a number beyond the bounds of the integer type will return a float instead.
php > var_dump(PHP_INT_MAX + 1); double(9.2233720368548E+18) php > var_dump(hexdec('ffffffff'.'ffffffff')); double(1.844674407371E+19)I wonder if it would be reasonable to get msgpack_unpack() in line with PHP engine? Or return a string representation of the value?
Metadata
Metadata
Assignees
Labels
No labels