ID: 31245
Updated by: [EMAIL PROTECTED]
Reported By: rhm31 at cam dot ac dot uk
-Status: Open
+Status: Bogus
-Bug Type: Zend Engine 2 problem
+Bug Type: Scripting Engine problem
Operating System: FreeBSD
PHP Version: 4.3.9
New Comment:
Yeah, don't do that. You can crash PHP with other infinite recursive
things too. This won't change.
Previous Comments:
------------------------------------------------------------------------
[2004-12-22 15:41:02] rhm31 at cam dot ac dot uk
In the example code, the first $obj=&new A; is not needed, sorry.
------------------------------------------------------------------------
[2004-12-22 15:39:24] rhm31 at cam dot ac dot uk
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 this bug report at http://bugs.php.net/?id=31245&edit=1