Edit report at https://bugs.php.net/bug.php?id=55798&edit=1
ID: 55798 Updated by: cataphr...@php.net Reported by: lukas dot zierer at abf dot ch Summary: serialize followed by unserialize with numeric object prop. gives integer prop. -Status: Assigned +Status: Closed Type: Bug Package: Unknown/Other Function Operating System: at least on Windows PHP Version: Irrelevant Assigned To: cataphract Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. 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/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2011-09-28 14:47:22] cataphr...@php.net Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&revision=317438 Log: - Fixed #55798: serialize followed by unserialize with numeric object prop. gives integer prop. ------------------------------------------------------------------------ [2011-09-27 12:51:36] lukas dot zierer at abf dot ch Description: ------------ Hi there! I am having a standard class using numeric keys as properties which works fine in general. The numeric keys are currently Strings. After serializing and unserializing the class, the properties will be converted to Integers which makes them unaccessible. Have a look at the code example below. Regards Lukas Test script: --------------- <?php $a = new stdClass(); $a->{0} = 'X'; $a->{1} = 'Y'; var_dump($a); echo "\n0:", $a->{0}, "\n1:", $a->{1}, "\n\n"; $b = unserialize(serialize($a)); var_dump($b); echo "\n0:", $b->{0}, "\n1:", $b->{1}, "\n\n"; ?> Expected result: ---------------- object(stdClass)#2 (2) { ["0"]=> string(1) "X" ["1"]=> string(1) "Y" } Actual result: -------------- object(stdClass)#2 (2) { [0]=> string(1) "X" [1]=> string(1) "Y" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55798&edit=1