xref: /PHP-8.1/Zend/tests/generators/bug74606.phpt (revision f8d79582)
1--TEST--
2Bug #74606 (Segfault within try/catch/finally nesting in Generators)
3--FILE--
4<?php
5
6function gen() {
7    $array = ["foo"];
8    $array[] = "bar";
9
10    foreach ($array as $item) {
11        try {
12            try {
13                yield;
14            } finally {
15                echo "fin $item\n";
16            }
17        } catch (\Exception $e) {
18            echo "catch\n";
19            continue;
20        }
21    }
22}
23gen()->throw(new Exception);
24
25?>
26--EXPECT--
27fin foo
28catch
29fin bar
30