php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53511 Exceptions are lost in case an exception is thrown in catch operator
Submitted: 2010-12-09 16:40 UTC Modified: 2010-12-09 17:38 UTC
From: dmitry@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: trunk-SVN-2010-12-09 (SVN) OS: *
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: dmitry@php.net
New email:
PHP Version: OS:

 

 [2010-12-09 16:40 UTC] dmitry@php.net
Description:
------------
In ZEND_CATCH instruction PHP assigns exception object to the given variable and destroys its previous value, but this variable might keep an object that throws an exception during destruction. As result PHP loses both exceptions.

Test script:
---------------
<?php
class Foo {
	function __destruct() {
		throw new Exception("ops 1");
	}
}

function test() {
	$e = new Foo();
	try {
		throw new Exception("ops 2");
	} catch (Exception $e) {
		echo $e->getMessage()."\n";
	}
}

test();
echo "bug\n";


Expected result:
----------------
information about exception(s)

Actual result:
--------------
bug

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-09 16:40 UTC] dmitry@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2010-12-09 17:38 UTC] dmitry@php.net
Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=306135
Log: Fixed bug #53511 (Exceptions are lost in case an exception is thrown in catch operator)
 [2010-12-09 17:38 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2010-12-09 17:38 UTC] dmitry@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC