Bug #74606 [Opn->Csd]: Segfault within try/catch/finally nesting in Generators
| From: | bwoebi@php.net | Date: | Wed, 17 May 2017 17:59:20 +0000 |
| Subject: | Bug #74606 [Opn->Csd]: Segfault within try/catch/finally nesting in Generators | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209170@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74606&edit=1
ID: 74606
Updated by: bwoebi@php.net
Reported by: bwoebi@php.net
Summary: Segfault within try/catch/finally nesting in
Generators
-Status: Open
+Status: Closed
Type: Bug
Package: Reproducible crash
Operating System: Irrelevant
PHP Version: 7.1Git-2017-05-17 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=649494c0ee54102ac4a6c62fd5faf38143efb107
Log: Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators)
Previous Comments:
------------------------------------------------------------------------
[2017-05-17 17:52:08] bwoebi@php.net
Description:
------------
Nesting a try/finally inside a try/catch in a loop within a Generator will cause too many live vars
to be cleaned up (i.e. outside its live range).
Test script:
---------------
function gen() {
$array = ["foo"];
$array[] = "bar";
foreach ($array as $item) {
try {
try {
yield;
} finally {
echo "fin $item\n";
}
} catch (\Exception $e) {
echo "catch\n";
continue;
}
}
}
$g = gen();
$g->throw(new Exception);
Expected result:
----------------
fin foo
catch
fin bar
Actual result:
--------------
fin foo
catch
fin bar
<segmentation fault>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74606&edit=1