xref: /PHP-8.2/Zend/tests/generators/gh15851.phpt (revision 706bcdbc)
1--TEST--
2GH-15851: Access on NULL when printing backtrace with freed generator
3--FILE--
4<?php
5
6class Foo {
7    public function __destruct() {
8        debug_print_backtrace();
9    }
10}
11
12function bar() {
13    yield from foo();
14}
15
16function foo() {
17    $foo = new Foo();
18    yield;
19}
20
21$gen = bar();
22foreach ($gen as $dummy);
23
24?>
25--EXPECTF--
26#0 %s(%d): Foo->__destruct()
27#1 %s(%d): bar()
28