xref: /PHP-7.4/Zend/tests/generators/bug71601.phpt (revision d679f022)
1--TEST--
2Bug #71601 (finally block not executed after yield from)
3--FILE--
4<?php
5
6function gen1() {
7	try {
8		yield 1;
9		yield 2;
10		return true;
11	} finally {
12		echo "Inner finally\n";
13	}
14}
15
16function gen2() {
17	try {
18		echo "Entered try/catch\n";
19		var_dump(yield from gen1());
20	} finally {
21		echo "Finally\n";
22	}
23}
24
25$generator = gen2();
26
27var_dump($generator->current());
28
29unset($generator);
30
31echo "Done\n";
32
33?>
34--EXPECT--
35Entered try/catch
36int(1)
37Inner finally
38Finally
39Done
40