php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47349 Seriliazing and Unserializing and obj breaks numeric keys
Submitted: 2009-02-09 14:10 UTC Modified: 2009-02-11 15:04 UTC
From: darren at viamedia dot co dot za Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2CVS-2009-02-09 (snap) OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: darren at viamedia dot co dot za
New email:
PHP Version: OS:

 

 [2009-02-09 14:10 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-10 21:43 UTC] felipe@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 03 01:00:01 2025 UTC