xref: /PHP-8.3/Zend/tests/gh15275-001.phpt (revision c767fec2)
1--TEST--
2GH-15275 001: Crash during GC of suspended generator delegate
3--FILE--
4<?php
5
6class It implements \IteratorAggregate
7{
8    public function getIterator(): \Generator
9    {
10        yield 'foo';
11        Fiber::suspend();
12        var_dump("not executed");
13    }
14}
15
16function f() {
17    var_dump(yield from new It());
18}
19
20$iterable = f();
21
22$fiber = new Fiber(function () use ($iterable) {
23    var_dump($iterable->current());
24    $iterable->next();
25    var_dump("not executed");
26});
27
28$ref = $fiber;
29
30$fiber->start();
31
32gc_collect_cycles();
33
34?>
35==DONE==
36--EXPECT--
37string(3) "foo"
38==DONE==
39