php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41283 WDDX deserialize array key bug
Submitted: 2007-05-04 14:37 UTC Modified: 2007-05-05 15:15 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: php dot net at trueprices dot net Assigned:
Status: Closed Package: WDDX related
PHP Version: 5.2.2 OS: Debian
Private report: No CVE-ID:
 [2007-05-04 14:37 UTC] php dot net at trueprices dot net
Description:
------------
wddx_deserialize/wddx_unserialize does not deserialize the array keys correctly

Array with the following keys will not deserialize correctly in PHP 5.2.1 & 5.2.2 but did deserialize correctly in PHP4

array('1.1' => 'One 1','1.2' => 'One 2') 

array keys will become 1  and therefor the 2nd key 1.2 will overwrite the first key 1.1

Reproduce code:
---------------
<?php
$data = array(
  'somearray' => array('1.1' => 'One 1','1.2' => 'One 2')
);

echo "<pre>Should be:\n";
var_dump(array('data'=>$data));
echo '</pre>';

echo "<pre>Is:\n";
var_dump(wddx_deserialize(wddx_serialize_vars('data')));
echo '</pre>';
?>

Expected result:
----------------
array(1) {
  ["data"]=>
  array(1) {
    ["somearray"]=>
    array(2) {
      ["1.1"]=>
      string(5) "One 1"
      ["1.2"]=>
      string(5) "One 2"
    }
  }
}

Actual result:
--------------
array(1) {
  ["data"]=>
  array(1) {
    ["somearray"]=>
    array(1) {
      [1]=>
      string(5) "One 2"
    }
  }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-05 15:15 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 10:03:03 2014 UTC