Thursday, October 28, 2010

var_export bug Fatal error: Nesting level too deep - recursive dependency? [Workaround]

When doing var_export() on nested arrays/objects with recursive dependency, you'll get an error:

Fatal error: Nesting level too deep - recursive dependency? in /some/script.php on line 123

The workaround is:

ob_start();
var_dump($data);
$dataDump = ob_get_clean();

Bug report (but is incorrectly marked as Bogus): http://bugs.php.net/bug.php?id=30471

1 comment:

  1. A wonderful article you posted. That is so informatory and creative. Please keep these excellent posts coming.
    Server Transfer

    ReplyDelete