Bug #68165 [Opn]: Loosing exception in try-throw-finally
| From: | alexeydsov at gmail dot com | Date: | Mon, 06 Oct 2014 13:45:56 +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-187884@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
User updated by: alexeydsov at gmail dot com
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
Block user comment: N
Private report: N
New Comment:
This bug makes unusable finally block for 5.5. Because any code theoretically can try and catch
exception somewhere inside.
Previous Comments:
------------------------------------------------------------------------
[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