Bug #68165 [Opn]: Loosing exception in try-throw-finally

From: Date: Mon, 06 Oct 2014 19:03:06 +0000
Subject: Bug #68165 [Opn]: Loosing exception in try-throw-finally
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187899@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68165&edit=1

 ID:                 68165
 Updated by:         nikic@php.net
 Reported by:        alexeydsov at gmail dot com
 Summary:            Loosing exception in try-throw-finally
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Ubuntu
 PHP Version:        5.5.17
-Assigned To:        
+Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

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...


Previous Comments:
------------------------------------------------------------------------
[2014-10-06 13:45:56] 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 13:41:08] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68165&edit=1


Thread (4 messages)

« previous php.bugs (#187899) next »