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