Bug #62550 [Opn->Nab]: Exception in Exception
Edit report at https://bugs.php.net/bug.php?id=62550&edit=1
ID: 62550
Updated by: ab@php.net
Reported by: nabody at nm dot ru
Summary: Exception in Exception
-Status: Open
+Status: Not a bug
Type: Bug
Package: Class/Object related
Operating System: windows
PHP Version: 5.3.14
Block user comment: N
Private report: N
New Comment:
Doing this the way you suggest would put would put the script into the infinite
loop. The exception inside its handler would call the handler again and again.
Previous Comments:
------------------------------------------------------------------------
[2012-07-13 13:32:04] nabody at nm dot ru
XAMPP 1.7.7 [PHP: 5.3.8]
------------------------------------------------------------------------
[2012-07-13 12:43:51] nabody at nm dot ru
Description:
------------
Do not handle the exception in the exception.
Test script:
---------------
set_exception_handler(function($e){
set_exception_handler(function($e){echo $e->getMessage();});
echo $e->getMessage();
throw new Exception('Fail 2');
});
throw new Exception('Fail 1');
Expected result:
----------------
Fail 1
Fail 2
Actual result:
--------------
Fail 1
Fatal error: Uncaught exception 'Exception' with message 'Fail 2' in ...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62550&edit=1
Thread (3 messages)