1--TEST-- 2Exceptions are properly appended when thrown from yield from values destruction 3--FILE-- 4<?php 5 6function gen() { 7 yield from [1, 2, new class { 8 function __destruct() { 9 throw new Exception("dtor"); 10 } 11 }]; 12} 13 14gen()->throw(new Exception("outer")); 15 16?> 17--EXPECTF-- 18Fatal error: Uncaught Exception: outer in %s:%d 19Stack trace: 20#0 {main} 21 22Next Exception: dtor in %s:%d 23Stack trace: 24#0 %s(%d): class@anonymous->__destruct() 25#1 [internal function]: gen() 26#2 %s(%d): Generator->throw(Object(Exception)) 27#3 {main} 28 thrown %s on line %d 29