Re: Print_r bug?

From: Date: Wed, 12 Feb 2003 16:01:51 +0000
Subject: Re: Print_r bug?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-135321@lists.php.net to get a copy of this message
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.

« previous php.general (#135321) next »