#31245 [NEW]: Assigning reference to self results in &$GLOBALS

From: Date: Wed, 22 Dec 2004 14:39:25 +0000
Subject: #31245 [NEW]: Assigning reference to self results in &$GLOBALS
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70907@lists.php.net to get a copy of this message
From: rhm31 at cam dot ac dot uk Operating system: FreeBSD PHP version: 4.3.9 PHP Bug Type: Zend Engine 2 problem Bug description: Assigning reference to self results in &$GLOBALS Description: ------------ Assigning an global object to be a reference of itself causes the object to point to $GLOBALS, but only when read from $GLOBALS. This shows up as the *RECURSION* in the acutal result below. Note also that Win32 works fine but FreeBSD gives this problem. Reproduce code: --------------- <?php class A { } $obj=&new A; function &GetA() { global $obj; return $obj; } $obj=&new A; $obj=&GetA(); echo("<PRE>"); var_dump($obj); print_r($GLOBALS); echo("</PRE>"); ?> Expected result: ---------------- object(a)(0) { } Array ( ... [GLOBALS] => Array *RECURSION* [obj] => a Object ( ) ) //Note this result is obtained in PHP 4.3.9 on Win32 Actual result: -------------- object(a)(0) { } Array ( ... [GLOBALS] => Array *RECURSION* [obj] => Array *RECURSION* ) //Note this result is obtained in PHP 4.3.9 on FreeBSD -- Edit bug report at http://bugs.php.net/?id=31245&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31245&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31245&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31245&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31245&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31245&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31245&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31245&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31245&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31245&r=support Expected behavior: http://bugs.php.net/fix.php?id=31245&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31245&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31245&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31245&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31245&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31245&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31245&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31245&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31245&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31245&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31245&r=mysqlcfg

« previous php.bugs (#70907) next »