ID: 48171 Updated by: j...@php.net Reported By: csnyder at fcny dot org -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.2.9 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2009-05-06 18:36:32] csnyder at fcny dot org 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" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48171&edit=1