1--TEST-- 2Generator::throw() on an already closed generator 3--FILE-- 4<?php 5 6function gen() { 7 yield; 8} 9 10$gen = gen(); 11$gen->next(); 12$gen->next(); 13var_dump($gen->valid()); 14$gen->throw(new Exception('test')); 15 16?> 17--EXPECTF-- 18bool(false) 19 20Fatal error: Uncaught Exception: test in %s:%d 21Stack trace: 22#0 {main} 23 thrown in %s on line %d 24