|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-10-18 17:33 UTC] 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? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 04:00:02 2025 UTC |
I don't believe this is a bug as the purposes of var_dump and var_export are entirely different: var_dump - simply dumps a readable form var_export - exports valid PHP! This code is actually usable within an application. var_dump therefore can "manage" the recursive nature of global by simply doing the following in the output &array(15) { ["GLOBALS"]=> *RECURSION* var_export on the other hand clearly can't take the same approach to recursion if the generated PHP output is to work as intended by the application designer. - it can only (and should only) fail. hope this is useful to someone.