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?> 18--EXPECTF-- 191 20 21Fatal error: Uncaught Exception in %s:%d 22Stack trace: 23#0 %s(%d): foo(1, 5) 24#1 {main} 25 thrown in %s on line %d 26