|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-04-02 23:44 UTC] felipe@php.net
[2010-04-03 00:04 UTC] felipe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
[2010-04-03 00:04 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
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* ) )