#38376 [Bgs]: unserialize between 64bit and 32bit systems
| From: | are at fronter dot com | Date: | Tue, 08 Aug 2006 12:16:39 +0000 |
| Subject: | #38376 [Bgs]: unserialize between 64bit and 32bit systems | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100518@lists.php.net to get a copy of this message | ||
ID: 38376
User updated by: are at fronter dot com
Reported By: are at fronter dot com
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Linux
PHP Version: 4.4.3
New Comment:
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?
Previous Comments:
------------------------------------------------------------------------
[2006-08-08 12:05:33] tony2001@php.net
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