1--TEST-- 2finally is run even if a generator is closed mid-execution 3--FILE-- 4<?php 5 6function gen() { 7 try { 8 try { 9 echo "before yield\n"; 10 yield; 11 echo "after yield\n"; 12 } finally { 13 echo "finally run\n"; 14 } 15 echo "code after finally\n"; 16 } finally { 17 echo "second finally run\n"; 18 } 19 echo "code after second finally\n"; 20} 21 22$gen = gen(); 23$gen->rewind(); 24unset($gen); 25 26?> 27--EXPECT-- 28before yield 29finally run 30second finally run 31