Bug #16609: Function called from class treats GLOBAL vars in different way...

From: Date: Mon, 15 Apr 2002 09:38:00 +0000
Subject: Bug #16609: Function called from class treats GLOBAL vars in different way...
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-5005@lists.php.net to get a copy of this message
From: daniel@webdevelopers.cz Operating system: Windows 2000, Windows XP PHP version: 4.1.2 PHP Bug Type: Class/Object related Bug description: Function called from class treats GLOBAL vars in different way... There is the line marked with '//*' in the following script. One line up you will find other line that should make the exactly same action (I think). Try to comment this line and uncomment line with '//*'. The output will differ. Why? --- SCRIPT: START --- <PRE> <?php class test { function test() { extfunc($this); } } #__________________________________________________________________________________________________ function extfunc(&$ref) { global $obj; if (is_object($ref)) { $GLOBALS["obj"]=&$ref; # This is the same as '$obj=&$ref;'. Isn't it? #* $obj=&$ref; } } #================================================================================================== $test=new test(); var_dump($obj); ?> </PRE> --- SCRIPT: END --- -- Edit bug report at http://bugs.php.net/?id=16609&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16609&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16609&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16609&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16609&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16609&r=support Expected behavior: http://bugs.php.net/fix.php?id=16609&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16609&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16609&r=submittedtwice

« previous php.bugs (#5005) next »