Edit report at http://bugs.php.net/bug.php?id=30471&edit=1
ID: 30471 Comment by: hendy at soluvas dot com Reported by: none at example dot com Summary: var_export: Nesting level too deep - recursive dependency? Status: Bogus Type: Bug Package: PHP options/info functions Operating System: Linux PHP Version: 5.0.2 Assigned To: derick Block user comment: N New Comment: This bug is VALID! The following code works: var_dump($GLOBALS); Therefore the dumping algorithm is inconsistent. var_export() should just use the same algorithm as var_dump(). Previous Comments: ------------------------------------------------------------------------ [2010-06-27 05:55:26] jdickey at seven-sigma dot com Derick, I'd suggest that that "expected behavior" itself is a design flaw in the PHP interpreter. The solutions I can think of right off would be ugly, granted (special-case check for global-variable accessor to detect whether it's attempting to recurse as an effect of debug_backtrace() and, if so, throw an exception that can then be caught by d_bt); I find it really hard to believe that such a heavily- used software platform with such a large, competent company and community behind it can't come up with a better solution. Marking this bug as 'bogus' merely insults your developer customers and encourages them to go find a real language instead. ------------------------------------------------------------------------ [2004-11-15 20:19:24] der...@php.net There is no way to return a correct output in this case, so this is not a bug but expected behavior. ------------------------------------------------------------------------ [2004-10-18 17:33:05] none at example dot com Description: ------------ doing var_export( $GLOBALS, true ) there is an error like in older versions of php4: Nesting level too deep - recursive dependency? Of course it is easy to do a workaround, but maybe it would be nice to fix it. Theres a lot of discussion araound this bug in some communities for older php versions. Maybe it is me being in error or maybe this is just a feature and not a bug? In this case sorry for disturbing... Thanks a lot for all your work! Reproduce code: --------------- <?php $outText = var_export( $GLOBALS, true ); ?> Expected result: ---------------- I would expect to get var_export in $outText Actual result: -------------- array ( 'GLOBALS' => array ( 'GLOBALS' => array ( 'GLOBALS' => array ( Fatal error: Nesting level too deep - recursive dependency? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=30471&edit=1