xref: /PHP-8.2/Zend/tests/fibers/gh9735-007.phpt (revision 4fb14939)
1--TEST--
2Bug GH-9735 007 (Fiber stack variables do not participate in cycle collector)
3--FILE--
4<?php
5
6class C {
7    public function __destruct() {
8        echo __METHOD__, "\n";
9    }
10}
11
12function f() {
13    $fiber = Fiber::getCurrent();
14
15    // Force symbol table
16    get_defined_vars();
17
18    Fiber::suspend();
19}
20
21$fiber = new Fiber(function () {
22    $c = new C();
23
24    // Force symbol table
25    get_defined_vars();
26
27    f();
28});
29
30print "1\n";
31
32$fiber->start();
33gc_collect_cycles();
34
35print "2\n";
36
37$fiber = null;
38gc_collect_cycles();
39
40print "3\n";
41
42?>
43--EXPECTF--
441
452
46C::__destruct
473
48