php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41527 WDDX deserialize numeric string array key bugs
Submitted: 2007-05-29 09:07 UTC Modified: 2007-06-11 15:21 UTC
From: php_lists at realplain dot com Assigned: iliaa (profile)
Status: Closed Package: WDDX related
PHP Version: 5.2.3RC1 OS:
Private report: No CVE-ID: None
 [2007-05-29 09:07 UTC] php_lists at realplain dot com
Description:
------------
I sent a couple messages to the Internals mailing list over the last few weeks with a better fix for Bug #41283 (http://news.php.net/php.internals/29315), but they seem to have been ignored, so I'm opening this bug (and I discovered wrong changes in the 4.4 branch that should be fixed).

As seen with the "Reproduce code," all branches are mishandling those types of numeric keys. They worked fine up to 4.4.0, I believe, until Bug #34068 was "fixed" there (it actually never existed in 4.x as there wasn't a change of the internal functions there). (That bogus 4.x change then caused Bug #35410, #41283 (not fixed in 4.x), etc.)

Just trying to prevent more future problems like Bug #38464 I created for array_count_values() (caused by the same internal change), where individual bugs get reported/fixed, instead of fixing the root cause. :-)

Here are patches to fix these bugs in each branch:
http://realplain.com/php/wddx_num_key.diff
http://realplain.com/php/wddx_num_key_5_2.diff
http://realplain.com/php/wddx_num_key_4_4.diff

Reproduce code:
---------------
<?php

$data = array('01' => 'Zero', '+1' => 'Plus sign', ' 1' => 'Space');
var_dump(wddx_deserialize(wddx_serialize_vars('data')));

Expected result:
----------------
array(3) {
  ["01"]=>
  string(4) "Zero"
  ["+1"]=>
  string(9) "Plus sign"
  [" 1"]=>
  string(5) "Space"
}

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-11 15:21 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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC