1--TEST-- 2Fibers in destructors 002: Start in destructor 3--FILE-- 4<?php 5 6register_shutdown_function(function () { 7 printf("Shutdown\n"); 8}); 9 10class Cycle { 11 public static $counter = 0; 12 public $self; 13 public function __construct() { 14 $this->self = $this; 15 } 16 public function __destruct() { 17 $id = self::$counter++; 18 printf("%d: Start destruct\n", $id); 19 $f = new Fiber(function () { }); 20 $f->start(); 21 printf("%d: End destruct\n", $id); 22 } 23} 24 25new Cycle(); 26new Cycle(); 27gc_collect_cycles(); 28 29?> 30--EXPECT-- 310: Start destruct 320: End destruct 331: Start destruct 341: End destruct 35Shutdown 36