xref: /PHP-7.2/Zend/tests/bug69740.phpt (revision 84052655)
1--TEST--
2Bug #69740: finally in generator (yield) swallows exception in iteration
3--FILE--
4<?php
5
6function generate() {
7    try {
8        yield 1;
9        yield 2;
10    } finally {
11        echo "finally\n";
12    }
13}
14
15foreach (generate() as $i) {
16    echo $i, "\n";
17    throw new Exception();
18}
19
20?>
21--EXPECTF--
221
23finally
24
25Fatal error: Uncaught Exception in %s:%d
26Stack trace:
27#0 {main}
28  thrown in %s on line %d
29