|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51362 var_export() second argument ignored on recursion fatal error
Submitted: 2010-03-23 12:40 UTC Modified: 2015-01-20 14:41 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: daan at react dot com Assigned: derick (profile)
Status: Not a bug Package: Output Control
PHP Version: 5.2.13 OS: Debian Etch
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
24 + 9 = ?
Subscribe to this entry?

 [2010-03-23 12:40 UTC] daan at react dot com
When calling var_export() on a recursive array, with the 'return' parameter set to true, a partial var_exported string is echoed and then a fatal error is raised. 
A more correct handling should be to just raise the php fatal error, not output the partial string. (sensitive data might be accidentally shown, for example)

Test script:
$recursive = array();
$recursive[] = &$recursive; 

$test = var_export($recursive, true);

Expected result:
Fatal error: Nesting level too deep - recursive dependency? in test.php on line x

Actual result:
array ( 0 => array ( 0 => array ( 0 => array ( 0 => array ( 
Fatal error: Nesting level too deep - recursive dependency? in test.php on line x


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-23 14:16 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: derick
 [2010-04-13 20:37 UTC] neel dot basu dot z at gmail dot com
Looks like similar to
 [2012-01-13 12:03 UTC] dduniec at go2 dot pl
I've just experience that error during debug on production environment. I've used 
it with debug_backtrace() var_export(debug_backtrace(), true) ... it outputs all 
information on the screen before nesting level error.
 [2015-01-19 23:12 UTC]
-Status: Assigned +Status: Not a bug
 [2015-01-19 23:12 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

I can not reproduce this with PHP 5.2.18 (or PHP 5.3.29 or later).
 [2015-01-20 14:41 UTC] daan at react dot com
It seems to have been fixed in the version after I reported it: (5.2.14) -
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 21:01:27 2023 UTC