#41283 [NEW]: WDDX deserialize array key bug

From: Date: Fri, 04 May 2007 14:37:12 +0000
Subject: #41283 [NEW]: WDDX deserialize array key bug
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112243@lists.php.net to get a copy of this message
From:             php dot net at trueprices dot net
Operating system: Debian
PHP version:      5.2.2
PHP Bug Type:     WDDX related
Bug description:  WDDX deserialize array key bug

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 bug report at http://bugs.php.net/?id=41283&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41283&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41283&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41283&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41283&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=41283&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41283&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41283&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41283&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41283&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41283&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=41283&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=41283&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41283&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41283&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41283&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41283&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41283&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41283&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41283&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41283&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#112243) next »