1--TEST-- 2GH-15275 003: Crash during GC of suspended generator delegate 3--FILE-- 4<?php 5 6class It implements \IteratorAggregate 7{ 8 public function getIterator(): \Generator 9 { 10 yield 'foo'; 11 throw new \Exception(); 12 var_dump("not executed"); 13 } 14} 15 16function f() { 17 try { 18 var_dump(new stdClass, yield from new It()); 19 } finally { 20 var_dump(__FUNCTION__); 21 } 22} 23 24function g() { 25 try { 26 var_dump(new stdClass, yield from f()); 27 } finally { 28 var_dump(__FUNCTION__); 29 } 30} 31 32$gen = g(); 33 34var_dump($gen->current()); 35$gen->next(); 36 37?> 38==DONE== 39--EXPECTF-- 40string(3) "foo" 41string(1) "f" 42string(1) "g" 43 44Fatal error: Uncaught Exception in %s:8 45Stack trace: 46#0 %s(15): It->getIterator() 47#1 %s(23): f() 48#2 [internal function]: g() 49#3 %s(32): Generator->next() 50#4 {main} 51 thrown in %s on line 8 52