ID: 20676
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Variables related
Operating System: All
PHP Version: 4.2.3
New Comment:
i thought that PHP count references on data before destroys it. This is
not the case. This is why $GLOBALS['ref'] is null isn't it ?
Previous Comments:
------------------------------------------------------------------------
[2002-11-27 09:22:51] [EMAIL PROTECTED]
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 this bug report at http://bugs.php.net/?id=20676&edit=1