Edit report at http://bugs.php.net/bug.php?id=51363&edit=1
ID: 51363
Comment by: whatrevolution at yahoo dot com
Reported by: daan at react dot com
Summary: Fatal error raised by var_export() not caught by error
handler
Status: Assigned
Type: Bug
Package: Scripting Engine problem
Operating System: Debian Etch
PHP Version: 5.2.13
Assigned To: derick
New Comment:
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)
Previous Comments:
------------------------------------------------------------------------
[2010-03-23 12:58:59] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51363&edit=1