|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-12-12 07:45 UTC] yohgaki@php.net
[2001-12-12 14:27 UTC] zak@php.net
[2002-01-02 14:04 UTC] lobbin@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
References to $this are randomly wrong during __wakeup. I am keeping track of all objects in a global $objs. global $objs; $objs[] =& $this; during __wakeup causes $objs[] to gain an element that matches some random OTHER variable in my script (an integer I was using somewhere, or an array I had somewhere else) Unforunately I cannot reproduce this on a simple script, but here is the essence of what I am doing: <? $objs = array(); class O { function __wakeup() { global $objs; $objs[] =& $this; } } class X extends O { var $a = 213; var $b = 'hello'; } $x = new X(); $y = serialize($x); $z = unserialize($y); var_dump($objs); ?> ^^ the above script works perfectly, but in a more complex script doing the same thing, it ends up putting a reference to a totally different variable into $objs.