1--TEST-- 2try { yield } finally { throw } 3--FILE-- 4<?php 5function foo($f, $t) { 6 for ($i = $f; $i <= $t; $i++) { 7 try { 8 yield $i; 9 } finally { 10 throw new Exception; 11 } 12 } 13} 14foreach (foo(1, 5) as $x) { 15 echo $x, "\n"; 16} 17--EXPECTF-- 181 19 20Fatal error: Uncaught exception 'Exception' in %s:%d 21Stack trace: 22#0 %s(%d): foo(1, 5) 23#1 {main} 24 thrown in %s on line %d 25