xref: /PHP-8.1/Zend/tests/bug78752.phpt (revision 16c49108)
1--TEST--
2Bug #78752: Segfault if GC triggered while generator stack frame is being destroyed
3--FILE--
4<?php
5
6function gen(&$gen) {
7    $a = new stdClass;
8    $a->a = $a;
9    $b = new stdClass;
10    $b->b = $b;
11    yield 1;
12}
13
14$gen = gen($gen);
15var_dump($gen->current());
16for ($i = 0; $i < 9999; $i++) {
17    $a = new stdClass;
18    $a->a = $a;
19}
20$gen->next();
21
22?>
23--EXPECT--
24int(1)
25