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