xref: /PHP-8.0/Zend/tests/try/bug71604_2.phpt (revision 921b3251)
1--TEST--
2Bug #71604: Aborted Generators continue after nested finally (2)
3--FILE--
4<?php
5
6function gen() {
7    try {
8        throw new Exception(1);
9    } finally {
10        try {
11            throw new Exception(2);
12        } finally {
13            try {
14                yield;
15            } finally {
16            }
17        }
18    }
19}
20
21try {
22    gen()->rewind();
23} catch (Exception $e) {
24    echo $e, "\n";
25}
26
27?>
28--EXPECTF--
29Exception: 1 in %s:%d
30Stack trace:
31#0 [internal function]: gen()
32#1 %s(%d): Generator->rewind()
33#2 {main}
34
35Next Exception: 2 in %s:%d
36Stack trace:
37#0 [internal function]: gen()
38#1 %s(%d): Generator->rewind()
39#2 {main}
40