#47349 [Opn->Bgs]: Seriliazing and Unserializing and obj breaks numeric keys

From: Date: Tue, 10 Feb 2009 21:43:21 +0000
Subject: #47349 [Opn->Bgs]: Seriliazing and Unserializing and obj breaks numeric keys
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133691@lists.php.net to get a copy of this message
 ID:               47349
 Updated by:       felipe@php.net
 Reported By:      darren at viamedia dot co dot za
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Ubuntu
 PHP Version:      5.2CVS-2009-02-09 (snap)
 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

See Bug#45959
Thanks.


Previous Comments:
------------------------------------------------------------------------

[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



Thread (4 messages)

« previous php.bugs (#133691) next »