|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61774 Public object variables with numbers as name are not public after unserialize
Submitted: 2012-04-19 14:43 UTC Modified: 2012-04-20 06:15 UTC
From: pandenitz at mail dot ru Assigned:
Status: Closed Package: Class/Object related
PHP Version: 5.3.11RC2 OS: Win 7 64x
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pandenitz at mail dot ru
New email:
PHP Version: OS:


 [2012-04-19 14:43 UTC] pandenitz at mail dot ru
Object variables with numbers as name are not public after unserialize.
So i.e. get_object_vars() doesn't return this vars because they are not public

Test script:

$a = new stdClass;
$varname = '1';
$a->$varname = 1;
$a->test = 1;

echo '<hr/>';

$s = serialize($a);
$a2 = unserialize($s);

echo '<hr/>';


Expected result:
Such vars should be public after unserialize.

Actual result:
Vars are not actually public.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-19 22:38 UTC]
Can repro on PHP 5.3, but not on 5.4. Everything fine there.
 [2012-04-19 22:51 UTC]
-Status: Open +Status: Feedback
 [2012-04-19 22:51 UTC]
Actually, I just tried again with a more updated 5.3 build and it works fine there.

The issue was fixed in which shipped with PHP 5.3.9.

Could you check a PHP 5.3 build >= 5.3.9 and see whether the issue persists?
 [2012-04-20 06:15 UTC] pandenitz at mail dot ru
Yes, I can confirm that it is fixed in recent 5.3.10.
Closing issue.
 [2012-04-20 06:15 UTC] pandenitz at mail dot ru
-Status: Feedback +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC