xref: /PHP-8.4/Zend/tests/gh15108-003.phpt (revision 99e0d3fe)
1--TEST--
2GH-15108 003: Segfault with delegated generator in suspended fiber
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($gen) {
17    yield from $gen;
18}
19
20$a = new It();
21$b = f($a);
22$c = f($a);
23
24$fiber = new Fiber(function () use ($a, $b, $c) {
25    var_dump($b->current());
26    $b->next();
27    var_dump("not executed");
28});
29
30$ref = $fiber;
31
32$fiber->start();
33
34?>
35==DONE==
36--EXPECT--
37string(3) "foo"
38==DONE==
39