1--TEST-- 2It is not possible to resume an already running generator 3--FILE-- 4<?php 5 6function gen() { 7 $gen = yield; 8 try { 9 $gen->next(); 10 } catch (Error $e) { 11 echo "\nException: " . $e->getMessage() . "\n"; 12 } 13 $gen->next(); 14} 15 16$gen = gen(); 17$gen->send($gen); 18$gen->next(); 19 20?> 21--EXPECTF-- 22Exception: Cannot resume an already running generator 23 24Fatal error: Uncaught Error: Cannot resume an already running generator in %s:%d 25Stack trace: 26#0 %s(%d): Generator->next() 27#1 [internal function]: gen() 28#2 %s(%d): Generator->send(Object(Generator)) 29#3 {main} 30 thrown in %s on line %d 31