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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nabody at nm dot ru
New email:
PHP Version: OS:

 

 [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 May 16 23:01:30 2024 UTC