From: [EMAIL PROTECTED]
Operating system: All
PHP version: 4.2.3
PHP Bug Type: Variables related
Bug description: Reinitialization of a reference
I try to keep reference on all instances of a class. Even, unserialized
one.
<?php
class A {
var $x=1;
function __wakeup(){
$GLOBALS['ref'] =& $this;
}
}
function set(){
//Serialize information
$a =& new A();
$a->x=2;
$data = serialize($a);
//Unserialize
$b =& unserialize($data); // i try without '&'
$result= $b === $GLOBALS['ref']; // $result == true;
echo "VALUE IN SET: {$b->x} \n"; // Echo 2
}
set();
echo "VALUE OUT SET: {$GLOBALS['ref']->x}\n"; //echo nothing,
$GLOBALS['ref'] is now NULL !
?>
I have read all docs, my eyes burns me but i really cannot understand. I
look in database too.
--
Edit bug report at http://bugs.php.net/?id=20676&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20676&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20676&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20676&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20676&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20676&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20676&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20676&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20676&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20676&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20676&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20676&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20676&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20676&r=isapi