php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51089 Serialisationof large numbers in arrays fails
Submitted: 2010-02-19 10:26 UTC Modified: 2010-02-22 09:03 UTC
From: phpnet4b7e640208df0 at mon-mail dot org Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.3.1 OS: Windows Server 2003 R2 Standard
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 17 = ?
Subscribe to this entry?

 
 [2010-02-19 10:26 UTC] phpnet4b7e640208df0 at mon-mail dot org
Description:
------------
Unserialisation of serialised arrays containing large numbers fails and unserialize returns FALSE. 
The issue appears to be in serialized() since unserialising an array serialised by an older version of PHP works as expected (as shown in reproduce code).
No error is reported (as expected with unserialize()) and no crash.

Reproduce code:
---------------
<?

$anArray = Array();
$anArray["anumber"]=212133254400;
$anArray["anothernumber"]=212164790400;

print("Serialised: "); print(serialize($anArray)); print("\n");
print("Unserialised: "); print_r(unserialize(serialize($anArray))); print("\n");
print("Error: "); print(unserialize(serialize($anArray))===FALSE?"yes":"no"); print("\n");
print("Old style: "); print_r(unserialize("a:2:{s:7:\"anumber\";d:212133254400;s:13:\"anothernumber\";d:212164790400;}")); print("\n");

?>

Expected result:
----------------
Serialised: a:2:{s:7:"anumber";d:212133254400;s:13:"anothernumber";d:212164790400;}
Unserialised:Array
(
    [anumber] => 212133254400
    [anothernumber] => 212164790400
)
Error: no
Old style: Array
(
    [anumber] => 212133254400
    [anothernumber] => 212164790400
)



Actual result:
--------------
Serialised: a:2:{s:7:"anumber";d:2121332543:0;s:13:"anothernumber";d:2121647903:0;}
Unserialised: 
Error: yes
Old style: Array
(
    [anumber] => 212133254400
    [anothernumber] => 212164790400
)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-19 12:28 UTC] pajoye@php.net
-Status: Open
+Status: Feedback

I can't reproduce it (with 5.3.1 or 5.3.2RC2). Can you try again with 5.3.2RC2? (http://windows.php.net/qa/)
 [2010-02-22 08:56 UTC] phpnet4b7e640208df0 at mon-mail dot org
I've downloaded new versions (both 5.3.1 and 5.3.2RC2) and they don't exhibit the same problems (only tested from command line, but assumed to be the same). It must be the way the binaries I'm using were compiled. Sorry for that.
Please close this bogus report.
 [2010-02-22 09:03 UTC] pajoye@php.net
As requested.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 04:01:33 2024 UTC