From:             taco at procurios dot nl
Operating system: linux
PHP version:      5.2.6
PHP Bug Type:     Class/Object related
Bug description:  serialize / unserialize $GLOBALS breaks global objects

Description:
------------
When serializing and later on deserializing the $GLOBALS array, global
objects aren't recreated.

Reproduce code:
---------------
class Foo
{
        public $foo;
        public function __construct($foo)
        {
                $this->foo = $foo;
        }
}
$Foo = new Foo(34);
var_dump($GLOBALS['Foo']);

$s = serialize($GLOBALS);
$GLOBALS = unserialize($s);

var_dump($GLOBALS['Foo']);

Expected result:
----------------
object(Foo)#1 (1) {
  ["foo"]=>
  int(34)
}
object(Foo)#1 (1) {
  ["foo"]=>
  int(34)
}

Actual result:
--------------
object(Foo)#1 (1) {
  ["foo"]=>
  int(34)
}
int(1)

-- 
Edit bug report at http://bugs.php.net/?id=45299&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45299&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45299&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45299&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45299&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45299&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45299&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45299&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45299&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45299&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45299&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45299&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45299&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45299&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45299&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45299&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45299&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45299&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45299&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45299&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45299&r=mysqlcfg

Reply via email to