|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-03-23 12:58 UTC] daan at react dot com
Description:
------------
When a fatal error is raised by var_export() when trying to export a resursive array, it is not caught by a user php error handler.
Test script:
---------------
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
var_dump($errno, $errstr, $errfile, $errline);
/* Don't execute PHP internal error handler */
return true;
}
set_error_handler("myErrorHandler");
$recursive = array();
$recursive[] = &$recursive;
var_export($recursive);
Expected result:
----------------
The var_dumped variables
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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
I am curious if the bug OP expects the var_export() output to never end... ever? I do, because it is a recursive reference, so I'm puzzled that this is considered a bug. However, perhaps the solution would be to not throw a fatal error, but throw a notice or warning and/or provide some way of telling var_export() how deep to print. array ( 0 => array ( 0 => array ( 0 => array ( 0 => array ( ( ! ) Fatal error: Nesting level too deep - recursive dependency? in /var/www/php_bugs/var_export_recursion_test.php on line 36 Call Stack # Time Memory Function Location 1 0.0004 108776 {main}( ) ../var_export_recursion_test.php:0 2 0.0004 109968 var_export ( ) ../var_export_recursion_test.php:36 PHP Version 5.2.10-2ubuntu6.4 System Linux 2.6.31-20-generic x86_64 Build Date Jan 6 2010 22:36:47 Server API Apache 2.0 Handler PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety disabled Zend Memory Manager enabled Apache/2.2.12 (Ubuntu)