#41283 [Opn->Csd]: WDDX deserialize array key bug

From: Date: Sat, 05 May 2007 15:15:14 +0000
Subject: #41283 [Opn->Csd]: WDDX deserialize array key bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112295@lists.php.net to get a copy of this message
ID: 41283 Updated by: iliaa@php.net Reported By: php dot net at trueprices dot net -Status: Open +Status: Closed Bug Type: WDDX related Operating System: Debian PHP Version: 5.2.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2007-05-04 14:37:12] 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" } } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41283&edit=1

« previous php.bugs (#112295) next »