1--TEST-- 2Generator exceptions during shutdown should not be swallowed 3--FILE-- 4<?php 5 6function gen() { 7 try { 8 echo "before yield\n"; 9 yield; 10 echo "after yield\n"; 11 } finally { 12 echo "before yield in finally\n"; 13 yield; 14 echo "after yield in finally\n"; 15 } 16 echo "after finally\n"; 17} 18 19$gen = gen(); 20$gen->rewind(); 21 22?> 23--EXPECTF-- 24before yield 25before yield in finally 26 27Fatal error: Uncaught Error: Cannot yield from finally in a force-closed generator in %s:%d 28Stack trace: 29#0 [internal function]: gen() 30#1 {main} 31 thrown in %s on line %d 32