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
 [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

Pull Requests

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 Dec 27 00:01:30 2024 UTC