Bug #68165 [Opn]: Loosing exception in try-throw-finally
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)