1--TEST--
2GC can cleanup cycle when callback references fiber
3--FILE--
4<?php
5
6$ref = new class () {
7    public $fiber;
8
9    public function __destruct() {
10        var_dump('DTOR');
11    }
12};
13
14$fiber = new Fiber(function () use ($ref) {
15    die('UNREACHABLE');
16});
17
18$ref->fiber = $fiber;
19
20$fiber = null;
21$ref = null;
22
23var_dump('COLLECT CYCLES');
24gc_collect_cycles();
25var_dump('DONE');
26
27?>
28--EXPECT--
29string(14) "COLLECT CYCLES"
30string(4) "DTOR"
31string(4) "DONE"
32