php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16065 print_r() and var_dump() infinite loop.
Submitted: 2002-03-14 09:26 UTC Modified: 2002-06-18 07:09 UTC
From: ahristov at icygen dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0CVS-2002-03-1 OS: RH 7.1
Private report: No CVE-ID: None
 [2002-03-14 09:26 UTC] ahristov at icygen dot com
<?php
//ob_start();
        $a=array();
        $a[]=&$a;
        array_pop($a);
        var_dump($GLOBALS);
//ob_end_flush();
?>
This piece of code causes infinite loop.
If the commments are removed than this little scripts starts to eat memory too fast. 100MB for 15secs. When the physical RAM was not available started to eat from the swap.
If var_export() is used no problems(with the CVS).
With 4.1.2 only causes Fatal Error - too deep recursion. Proably this has something with Yasuo's patch that tried force var_dump() to work like print_r() - showing recursion not just crashing.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-14 10:34 UTC] wez@php.net
This bug has been fixed in CVS.
 [2002-03-14 11:16 UTC] wez@php.net
Sorry - I misread the PR.
 [2002-03-14 20:51 UTC] yohgaki@php.net
Appearently, print_r() has the same problem :)  
 [2002-06-18 07:09 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 09:01:29 2024 UTC