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