|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-04-02 13:33 UTC] tyra3l at gmail dot com
-Operating System: Windows
+Operating System: Windows Xp Sp3, Debian Lenny
[2010-04-02 13:33 UTC] tyra3l at gmail dot com
[2010-04-02 13:35 UTC] tyra3l at gmail dot com
-Status: Open
+Status: Closed
[2010-04-02 13:35 UTC] tyra3l at gmail dot com
[2010-04-02 13:41 UTC] tyra3l at gmail dot com
[2010-04-02 14:56 UTC] derick@php.net
-Status: Closed
+Status: Re-Opened
[2010-04-02 15:19 UTC] tyra3l at gmail dot com
[2010-05-05 20:15 UTC] whatrevolution at yahoo dot com
[2010-05-05 21:24 UTC] tyra3l at gmail dot com
[2011-02-18 11:54 UTC] tyra3l at gmail dot com
-Status: Re-Opened
+Status: Closed
[2011-02-18 11:54 UTC] tyra3l at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 13:00:02 2025 UTC |
Description: ------------ It seems that there are some cases, when you can't catch Exceptions with exception_handler which was thrown from error_handler for some errors. For example if you do this: $class = new StdClass; echo $class->$foo; error_handler gets called, ErrorException was thrown, but the Exception wasn't catched with the exception_handler. if you try echo $foo; instead of echo $class->$foo; then the "same" error gets called with the error handler (by same error, I mean same parameters), but the Exception thrown in this case is successfuly catched by the exception handler. Test script: --------------- <?php error_reporting(E_ALL); ini_set('display_errors', 0); function debug($s){ echo "<pre>"; var_dump($s); echo "</pre>"; } set_error_handler( function ($errno, $errstr, $errfile, $errline ) { debug('error_handler'); debug(array( 'errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline, )); throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } ); set_exception_handler( function(Exception $e){ debug('exception_handler'); debug($e); } ); $class = new StdClass; echo $class->$foo; echo 'done'; Expected result: ---------------- string(13) "error_handler" array(4) { ["errno"]=> int(8) ["errstr"]=> string(23) "Undefined variable: foo" ["errfile"]=> string(55) "C:\work\xampp_vc9\htdocs\default\bug\error_handling.php" ["errline"]=> int(46) } string(17) "exception_handler" object(ErrorException)#4 (8) { ["message":protected]=> string(23) "Undefined variable: foo" ... Actual result: -------------- string(13) "error_handler" array(4) { ["errno"]=> int(8) ["errstr"]=> string(23) "Undefined variable: foo" ["errfile"]=> string(55) "C:\work\xampp_vc9\htdocs\default\bug\error_handling.php" ["errline"]=> int(46) }