ID: 47349 User updated by: darren at viamedia dot co dot za Reported By: darren at viamedia dot co dot za Status: Bogus Bug Type: Class/Object related Operating System: Ubuntu PHP Version: 5.2CVS-2009-02-09 (snap) New Comment:
Yes I see that bug BUT my issue is not with JSON but rather with serialize and unserialize with objects using interger keys Previous Comments: ------------------------------------------------------------------------ [2009-02-10 21:43:17] [email protected] 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 See Bug#45959 Thanks. ------------------------------------------------------------------------ [2009-02-09 14:49:18] darren at viamedia dot co dot za JSON ENCODE AND DECODE WORK AS I WOULD EXPECT SERIALIZE AND UN-SERIALIZE TO WORK $test = new stdClass(); $Id = 12; $test->$Id = new stdClass(); $test->$Id->value = 12; $Id = '23'; $test->$Id = new stdClass(); $test->$Id->value = '23'; var_dump($test); $ser = json_encode($test); $unser = json_decode($ser); echo '<hr />'; var_dump($unser); die('die'); ------------------------------------------------------------------------ [2009-02-09 14:10:18] darren at viamedia dot co dot za Description: ------------ Numeric Id keys for stdObj are lost after serializing and unseriliazing Reproduce code: --------------- $test = new stdClass(); $Id = 12; $test->$Id = new stdClass(); $test->$Id->value = 12; $Id = '23'; $test->$Id = new stdClass(); $test->$Id->value = '23'; var_dump($test); $ser = serialize($test); $unser = unserialize($ser); echo '<hr />'; var_dump($unser); die('die'); Expected result: ---------------- I would expect both dumps to be the same and the numeric Id keys be there after serializing Actual result: -------------- After serializing and Unserializing the numeric Id keys are lost ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47349&edit=1
