1--TEST-- 2Bug GH-9750 009 (Generator memory leak when interrupted during argument evaluation) 3--FILE-- 4<?php 5 6function f() { 7} 8 9class C { 10 public function __construct(public mixed $x) { 11 } 12 public function __invoke() { 13 } 14 public function __destruct() { 15 echo __METHOD__, "\n"; 16 } 17} 18 19$gen = function () use (&$gen) { 20 (new C($gen))(yield); 21}; 22 23$gen = $gen(); 24 25foreach ($gen as $value) { 26 break; 27} 28 29$gen = null; 30 31gc_collect_cycles(); 32 33?> 34==DONE== 35--EXPECT-- 36C::__destruct 37==DONE== 38