Bug #61774 [NEW]: Public object variables with numbers as name are not public after unserialize

From: Date: Thu, 19 Apr 2012 14:43:31 +0000
Subject: Bug #61774 [NEW]: Public object variables with numbers as name are not public after unserialize
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169734@lists.php.net to get a copy of this message
From:             
Operating system: Win 7 64x
PHP version:      5.3.11RC2
Package:          Class/Object related
Bug Type:         Bug
Bug description:Public object variables with numbers as name are not public after unserialize

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 bug report at https://bugs.php.net/bug.php?id=61774&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=61774&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=61774&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=61774&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=61774&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61774&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=61774&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=61774&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=61774&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=61774&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=61774&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=61774&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=61774&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=61774&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=61774&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=61774&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61774&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=61774&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=61774&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=61774&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=61774&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=61774&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#169734) next »