From:             php_lists at realplain dot com
Operating system: 
PHP version:      5.2.3RC1
PHP Bug Type:     WDDX related
Bug description:  WDDX deserialize numeric string array key bugs

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"
  }
}

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

Reply via email to