1--TEST-- 2Cannot "yield from" from force closed generator 3--FILE-- 4<?php 5 6function gen1() { 7 echo "gen1\n"; 8 yield 1; 9} 10 11function gen2() { 12 try { 13 echo "try\n"; 14 yield from gen1(); 15 } finally { 16 echo "finally\n"; 17 yield from gen1(); 18 } 19} 20 21try { 22 $gen = gen2(); 23 $gen->rewind(); 24 unset($gen); 25} catch (Error $e) { 26 echo $e, "\n"; 27} 28 29?> 30--EXPECTF-- 31try 32gen1 33finally 34Error: Cannot use "yield from" in a force-closed generator in %s:%d 35Stack trace: 36#0 %s(%d): gen2() 37#1 {main} 38