#34068 [Opn->Csd]: Numeric string as array key not cast to integer in wddx_deserialize()
| From: | iliaa@php.net | Date: | Wed, 10 Aug 2005 22:43:12 +0000 |
| Subject: | #34068 [Opn->Csd]: Numeric string as array key not cast to integer in wddx_deserialize() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83345@lists.php.net to get a copy of this message | ||
ID: 34068
Updated by: iliaa@php.net
Reported By: clemens at gutweiler dot net
-Status: Open
+Status: Closed
Bug Type: WDDX related
Operating System: *
PHP Version: 5CVS-2005-08-10
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:
------------------------------------------------------------------------
[2005-08-10 15:46:42] sniper@php.net
Nevermind that, we have it documented as expected behaviour.
WDDX should really be consistent with how PHP handles this..
------------------------------------------------------------------------
[2005-08-10 15:39:29] sniper@php.net
Actually it's not WDDX issue, but general issue with numeric array
index not staying as string but getting silently changed to integer:
<?php
$a = array ('123' => 'abc', 'abc' => '123');
var_dump($a);
?>
Outputs:
array(2) {
[123]=>
string(3) "abc"
["abc"]=>
string(3) "123"
}
Although this is pretty old issue, Dmitry, can you check?
------------------------------------------------------------------------
[2005-08-10 13:58:47] clemens at gutweiler dot net
Description:
------------
The vartype of the 123 key changed after serialization, it should be
consistent.
Reproduce code:
---------------
<?php
$data = array(
'123' => 'zahl',
'Foo' => 'bar',
);
var_dump( $data );
var_dump( wddx_deserialize( wddx_serialize_value( $data ) ) );
highlight_file( __FILE__ );
?>
Expected result:
----------------
array(2) {
["123"]=>
string(4) "zahl"
["Foo"]=>
string(3) "bar"
}
array(2) {
["123"]=>
string(4) "zahl"
["Foo"]=>
string(3) "bar"
}
Actual result:
--------------
array(2) {
[123]=>
string(4) "zahl"
["Foo"]=>
string(3) "bar"
}
array(2) {
["123"]=>
string(4) "zahl"
["Foo"]=>
string(3) "bar"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34068&edit=1