Bug #70012 [Asn->Csd]: Exception lost with nested finally block
| From: | laruence@php.net | Date: | Wed, 08 Jul 2015 09:21:37 +0000 |
| Subject: | Bug #70012 [Asn->Csd]: Exception lost with nested finally block | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194203@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70012&edit=1
ID: 70012
Updated by: laruence@php.net
Reported by: nickpeirson at gmail dot com
Summary: Exception lost with nested finally block
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Linux (Ubuntu 14.04)
PHP Version: 7.0.0alpha2
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ca30d5bf3947922a618d95f1ae16886204f37292
Log: Fixed bug #70012 (Exception lost with nested finally block)
Previous Comments:
------------------------------------------------------------------------
[2015-07-07 15:03:10] nickpeirson at gmail dot com
Description:
------------
If finally blocks are nested, odd behaviour arises with exceptions. The attached example
demonstrates an exception being thrown and never being caught, even though there's an
appropriate catch block.
While 5.5 behaves worse, e.g. you end up with an exception you can't catch, this behaviour is
still present in 5.6 and 7:
http://3v4l.org/3UF6O
Test script:
---------------
try {
echo "Outer try\n";
try {
echo " Middle try\n";
throw new Exception();
} finally {
echo " Middle finally\n";
try {
echo " Inner try\n";
} finally {
echo " Inner finally\n";
}
}
echo "Outer shouldnt get here\n";
} catch (Exception $e) {
echo "Outer catch\n";
} finally {
echo "Outer finally\n";
}
Expected result:
----------------
Outer try
Middle try
Middle finally
Inner try
Inner finally
Outer catch
Outer finally
Actual result:
--------------
Outer try
Middle try
Middle finally
Inner try
Inner finally
Outer shouldnt get here
Outer finally
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70012&edit=1