#42196 [Fbk->Opn]: unserialize artichecture problem
| From: | joungkyun at gmail dot com | Date: | Sat, 04 Aug 2007 16:42:10 +0000 |
| Subject: | #42196 [Fbk->Opn]: unserialize artichecture problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115755@lists.php.net to get a copy of this message | ||
ID: 42196
User updated by: joungkyun at gmail dot com
Reported By: joungkyun at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Output Control
Operating System: Linux
PHP Version: 5CVS-2007-08-03 (CVS)
New Comment:
I thinks that php has auto casting type. So, on 32bit systems php get
64bit interger, first convert casting type to double.
sorry for my pool english.
Previous Comments:
------------------------------------------------------------------------
[2007-08-04 14:08:04] jani@php.net
First of all, exactly why do you pass data like this between machines?
Secondly: OF course you can't pass huge integers to 32bit system. So
this is expected behaviour. What do you suggest happens in this case?
Try this on 32bit system:
echo (int) 4294967297;
------------------------------------------------------------------------
[2007-08-03 09:51:46] joungkyun at gmail dot com
Description:
------------
There is serialized data that made with 64bit integer on 64 bit
system.
On 32bit machine, if unserialize this data, you have result of integer
overflow.
Reproduce code:
---------------
On, 64bit system
echo serialize (4294967296 + 1);
=> result : "i:4294967297;"
On, 32bit system
echo unserilaize ("i:4294967297;");
=> result : 1
Expected result:
----------------
On, 32bit system
echo unserilaize ("i:4294967297;");
=> result : 4294967297
Actual result:
--------------
On, 32bit system
echo unserilaize ("i:4294967297;");
=> result : 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42196&edit=1