php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62550 Exception in Exception
Submitted: 2012-07-13 12:43 UTC Modified: 2012-07-16 16:08 UTC
From: nabody at nm dot ru Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3.14 OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 42 = ?
Subscribe to this entry?

 
 [2012-07-13 12:43 UTC] 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 ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-13 13:32 UTC] nabody at nm dot ru
-Summary: XAMPP 1.7.7 [PHP: 5.3.8] +Summary: Exception in Exception
 [2012-07-13 13:32 UTC] nabody at nm dot ru
XAMPP  1.7.7   [PHP: 5.3.8]
 [2012-07-16 16:08 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2012-07-16 16:08 UTC] ab@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 18:01:35 2024 UTC