php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68165 Loosing exception in try-throw-finally
Submitted: 2014-10-06 13:41 UTC Modified: 2014-10-07 02:39 UTC
Votes:6
Avg. Score:3.7 ± 1.5
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:4 (66.7%)
From: alexeydsov at gmail dot com Assigned: laruence (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.5.17 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alexeydsov at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-06 13:41 UTC] alexeydsov at gmail dot com
Description:
------------
If you throw Exception in try block and in finally block you throw and catch another exception than you loose first exception outside the try/catch/finally block. This bug work in 5.5.17, not work in 5.6.

Test script:
---------------
try {
	try {
		echo "1\n";
		throw new Exception("E1");
	} finally {
		try {
			echo "2\n";
			throw new Exception("E2");
		} catch (\Exception $e) {
			echo "3\n";
		}
	}
	echo "4-\n";
} catch (\Exception $e) {
	echo "4+".$e->getMessage()."\n";
}
echo "5\n";

Expected result:
----------------
1
2
3
4+E1
5

Actual result:
--------------
1
2
3
5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-06 13:45 UTC] alexeydsov at gmail dot com
This bug makes unusable finally block for 5.5. Because any code theoretically can try and catch exception somewhere inside.
 [2014-10-06 19:03 UTC] nikic@php.net
-Assigned To: +Assigned To: laruence
 [2014-10-06 19:03 UTC] nikic@php.net
There are a couple of finally issues that can't be fixed in PHP 5.5 due to ABI restrictions, I don't know if this is one of them. Maybe Xinchen can tell...
 [2014-10-07 02:39 UTC] laruence@php.net
-Status: Assigned +Status: Wont fix
 [2014-10-07 02:39 UTC] laruence@php.net
yes, this is one of them. 

http://3v4l.org/n1bQE

the problem is because, after finally supporting was merged into 5.5. we did a refactor to it for performance .. ...

and in the new impelmnetation, we need a extra field in EG to fix this issue, which will break ABI compitiable , thus is not allowed to merge into 5.5
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 16 08:01:34 2025 UTC