Bug #51445 [Opn->Csd]: var_dump() invalid/slow *RECURSION* detection
| From: | felipe@php.net | Date: | Fri, 02 Apr 2010 22:04:26 +0000 |
| Subject: | Bug #51445 [Opn->Csd]: var_dump() invalid/slow *RECURSION* detection | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149294@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51445&edit=1
ID: 51445
Updated by: felipe@php.net
Reported by: php at bfanger dot nl
Summary: var_dump() invalid/slow *RECURSION* detection
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: (Arch)Linux
PHP Version: 5.3.2
-Assigned To:
+Assigned To: felipe
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2010-04-02 23:44:11] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=297375
Log: - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection)
------------------------------------------------------------------------
[2010-03-31 14:09:51] php at bfanger dot nl
Description:
------------
The var_dump() function doesn't detect recursion properly(aka the first
time).
The code sample will show that var_dump() will print de "second" twice
instead
of once like in print_r().
This goes terribly wrong with large var_dumps with multiple recursion.
print_r() needed 5MiB memory for my dump. and var_dump() needed more
than the
ini_set("memory_limit", "1G") I applied.
Code for generating a big dump.
class IndexController extends Zend_Controller_Action {
public function indexAction() {
var_dump($this->_helpers);
}
}
Test script:
---------------
<?php
$array = array(
'first' => array(),
);
$array['first']['second'] = &$array['first'];
echo "<pre>\n";
var_dump($array);
echo "\n\n";
print_r($array);
echo "<pre>\n";
?>
Expected result:
----------------
<pre>
array(1) {
["first"]=>
&array(1) {
["second"]=>
*RECURSION*
}
}
Array
(
[first] => Array
(
[second] => Array
*RECURSION*
)
)
Actual result:
--------------
<pre>
array(1) {
["first"]=>
&array(1) {
["second"]=>
&array(1) {
["second"]=>
*RECURSION*
}
}
}
Array
(
[first] => Array
(
[second] => Array
*RECURSION*
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51445&edit=1