ID:               38376
 Updated by:       [EMAIL PROTECTED]
 Reported By:      are at fronter dot com
 Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Linux
 PHP Version:      4.4.3
 New Comment:

Unserializing this string:
i:2147483648;
is the same as (int)2147483648.


Previous Comments:
------------------------------------------------------------------------

[2006-08-08 12:16:39] are at fronter dot com

But PHP is in all other cases automaticly converting 
integer to float when the number gets too high. So why 
does it not do that in this case.

Does this mean that one can not mix 32 and 64 bit servers. 
Or does it mean that if you do, you must cast everything 
to float everywhere just to be sure?

When assigning with ex: "$i = (int)2147483648;" I can 
understand why it will be an overflow. But with "$i = 
2147483648;" it gets converted to float automaticly.
So when doing unserialize...why does it not do that.

Is there other functions besides serialize one can use to 
avoid this?

------------------------------------------------------------------------

[2006-08-08 12:05:33] [EMAIL PROTECTED]

Using numbers >= 2147483648 is expected to cause integer overflow on
32bit platforms.


------------------------------------------------------------------------

[2006-08-08 09:05:42] are at fronter dot com

Description:
------------
We run 10 webserver behind a loadbalancer. Some of these are 32bit and
some are 64bit.
When serializing an array containing the value 2147483648 on a 64bit
machine it is stored as an integer. The serialized string is stored in
a database. When unserializing on a 32bit machine this number becomes
-2147483648. Something that surely breaks a lot of things.

We are now casting the number to float to get around this, but I would
think that unserialize should convert the number to float if it can't
fit into an int on the running architecture.




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38376&edit=1

Reply via email to