But according to the manual:

Note: Prior to PHP 4.0.4, print_r() will continue forever if given
an array <http://www.php.net/manual/en/language.types.array.php> or
object <http://www.php.net/manual/en/language.types.object.php> that
contains a direct or indirect reference to itself. An example is
print_r($GLOBALS) because $GLOBALS is itself a global variable that
contains a reference to itself.

IMHO, it should do the same for a variable that contains a reference to a reference to itself (does that make sense?).

Johannes Schlueter wrote:

On Wednesday 12 February 2003 16:53, Leif K-Brooks wrote:

I think I've found a print_r bug with reference recursion. The
following example script runs forever:

<?php
$GLOBALS['foo'] = &$GLOBALS;
print_r($GLOBALS);
?>

Am I correct in thinking this is a bug that should be reported?

No, thats no bug. $GLOBALS includes $GLOBALS which include $GLOBALS....
Use var_dump for $GLOBALS instead ;-)

johannes


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


Reply via email to