Bug #61774 [Fbk->Csd]: Public object variables with numbers as name are not public after unserialize
| From: | pandenitz at mail dot ru | Date: | Fri, 20 Apr 2012 06:15:26 +0000 |
| Subject: | Bug #61774 [Fbk->Csd]: Public object variables with numbers as name are not public after unserialize | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-169774@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61774&edit=1
ID: 61774
User updated by: pandenitz at mail dot ru
Reported by: pandenitz at mail dot ru
Summary: Public object variables with numbers as name are not
public after unserialize
-Status: Feedback
+Status: Closed
Type: Bug
Package: Class/Object related
Operating System: Win 7 64x
PHP Version: 5.3.11RC2
Block user comment: N
Private report: N
New Comment:
Yes, I can confirm that it is fixed in recent 5.3.10.
Closing issue.
Previous Comments:
------------------------------------------------------------------------
[2012-04-19 22:51:40] nikic@php.net
Actually, I just tried again with a more updated 5.3 build and it works fine there.
The issue was fixed in http://svn.php.net/viewvc?view=revision&revision=317438
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-19 22:38:40] nikic@php.net
Can repro on PHP 5.3, but not on 5.4. Everything fine there.
------------------------------------------------------------------------
[2012-04-19 14:43:30] pandenitz at mail dot ru
Description:
------------
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:
---------------
<?php
$a = new stdClass;
$varname = '1';
$a->$varname = 1;
$a->test = 1;
var_dump($a);
print_r($a);
echo '<hr/>';
$s = serialize($a);
$a2 = unserialize($s);
var_dump($a2);
print_r($a2);
echo '<hr/>';
var_dump(get_object_vars($a2));
print_r(get_object_vars($a2));
Expected result:
----------------
Such vars should be public after unserialize.
Actual result:
--------------
Vars are not actually public.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61774&edit=1