|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-22 15:41 UTC] rhm31 at cam dot ac dot uk
[2005-03-17 09:20 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 03:00:01 2025 UTC |
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