|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-06 18:39 UTC] jani@php.net
[2009-05-06 18:43 UTC] csnyder at fcny dot org
[2009-05-06 18:44 UTC] jani@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 00:00:01 2025 UTC |
Description: ------------ When unserializing a string like O:8:"stdClass":3:{s:5:"22387";s:1:"a";s:5:"22386";s:1:"a";s:5:"22368";s:1:"a";}, the resulting object will have integers as property names instead of strings. This may be regression of #43614, marked fixed in CVS but that was a year ago. Reproduce code: --------------- <?php // an object with some numeric keys $keys = array( "1", "2", "3" ); foreach( $keys AS $key ) { $obj->{$key} = 'a'; } var_dump( $obj ); $s = serialize( $obj ); $u = unserialize( $s ); var_dump( $u ); ?> Expected result: ---------------- object(stdClass)#1 (3) { ["1"]=> string(1) "a" ["2"]=> string(1) "a" ["3"]=> string(1) "a" } object(stdClass)#2 (3) { ["1"]=> string(1) "a" ["2"]=> string(1) "a" ["3"]=> string(1) "a" } Actual result: -------------- object(stdClass)#1 (3) { ["1"]=> string(1) "a" ["2"]=> string(1) "a" ["3"]=> string(1) "a" } object(stdClass)#2 (3) { [1]=> string(1) "a" [2]=> string(1) "a" [3]=> string(1) "a" }