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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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

Pull Requests

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 Nov 22 08:01:28 2024 UTC