1--TEST-- 2GC can cleanup cycle when fiber result references fiber 3--EXTENSIONS-- 4fiber 5--FILE-- 6<?php 7 8$fiber = null; 9$fiber = new Fiber(function () use (&$fiber) { 10 return new class($fiber) { 11 private $fiber; 12 13 public function __construct($fiber) { 14 $this->fiber = $fiber; 15 } 16 17 public function __destruct() { 18 var_dump('DTOR'); 19 } 20 }; 21}); 22 23$fiber->start(); 24 25var_dump('COLLECT CYCLES'); 26gc_collect_cycles(); 27var_dump('DONE'); 28 29var_dump($fiber->isTerminated()); 30 31unset($fiber); 32 33var_dump('COLLECT CYCLES'); 34gc_collect_cycles(); 35var_dump('DONE'); 36 37?> 38--EXPECT-- 39string(14) "COLLECT CYCLES" 40string(4) "DONE" 41bool(true) 42string(14) "COLLECT CYCLES" 43string(4) "DTOR" 44string(4) "DONE" 45