#20670 [Opn->Ver]: Object reference with global variables bug

From: Date: Sun, 08 Dec 2002 17:01:57 +0000
Subject: #20670 [Opn->Ver]: Object reference with global variables bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-27065@lists.php.net to get a copy of this message
ID: 20670 Updated by: sniper@php.net Reported By: sitnikov@infonet.ee -Status: Open +Status: Verified Bug Type: Scripting Engine problem Operating System: Linux -PHP Version: 4.3.0RC1 +PHP Version: 4.3.0-dev Previous Comments: ------------------------------------------------------------------------ [2002-11-27 03:36:35] sitnikov@infonet.ee $globalref_bar===NULL after $o2 = &new Bar(); Source ---------------------------- <? $globalref_foo = array(); $globalref_bar = null; class Foo { function Foo() { global $globalref_foo; $globalref_foo[] = &$this; } } class Bar { function Bar() { global $globalref_bar; $globalref_bar = &$this; } } $o1 = &new Foo(); $o2 = &new Bar(); var_dump($globalref_foo); var_dump($globalref_bar); var_dump($o1); var_dump($o2); ?> Output: ---------------------------- array(1) { [0]=> &object(foo)(0) { } } NULL object(foo)(0) { } object(bar)(0) { } ----------------------------- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20670&edit=1

« previous php.bugs (#27065) next »