php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30917 Wrong keys in serialized obj's array
Submitted: 2004-11-27 05:57 UTC Modified: 2005-01-30 15:59 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:5 (100.0%)
From: dmirand at abelia-decors dot com Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.3.9 OS: Linux (64bit only!)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dmirand at abelia-decors dot com
New email:
PHP Version: OS:

 

 [2004-11-27 05:57 UTC] dmirand at abelia-decors dot com
Description:
------------
With objects storing an array with key values >= 2e31  
(2147483648), these keys are altered after a serialize +  
unserialize.  
  
Occurs only on 64bit systems.  
  

Reproduce code:
---------------
class Test {
  var $arr = array() ;
  function define_tab() {
    $noscde = "5000000000" ;
    $this->arr[$noscde]['noscde'] = $noscde ;
  }
  function get_tab() { return $this->arr; }
}
$obj = new Test() ;
$obj->define_tab() ;
print_r( $obj->get_tab() ) ;
$pok = serialize( $obj ) ;
$obj = unserialize( $pok ) ;
print_r( $obj->get_tab() ) ;


Expected result:
----------------
Array ( [5000000000] => Array ( [noscde] => 5000000000 ) ) 
Array ( [5000000000] => Array ( [noscde] => 5000000000 ) ) 

Actual result:
--------------
Array ( [5000000000] => Array ( [noscde] => 5000000000 ) ) 
Array ( [705032704] => Array ( [noscde] => 5000000000 ) ) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-18 12:42 UTC] sniper@php.net
Replace the print_r() with var_dump() please.
And paste the result you get.

 [2005-01-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-01-30 15:51 UTC] dmirand at abelia-decors dot com
Now with lastest CVS snapshot : 
 
array(1) { [5000000000]=> array(1) { ["noscde"]=> 
string(10) "5000000000" } } 
array(1) { [5000000000]=> array(1) { ["noscde"]=> 
string(10) "5000000000" } } 
 
Seems fixed now. 
Thanks !
 [2005-01-30 15:59 UTC] tony2001@php.net
Close it then.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 20:01:35 2024 UTC