xref: /php-src/Zend/tests/gh15108-001.phpt (revision 99e0d3fe)
1--TEST--
2GH-15108 001: 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
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
32?>
33==DONE==
34--EXPECT--
35string(3) "foo"
36==DONE==
37