xref: /PHP-8.1/Zend/tests/generators/bug65161.phpt (revision 5b59d491)
1--TEST--
2Bug #65161: Generator + autoload + syntax error = segfault
3--FILE--
4<?php
5
6function autoload() {
7    foo();
8}
9spl_autoload_register('autoload');
10
11function testGenerator() {
12    new SyntaxError('param');
13    yield;
14}
15
16foreach (testGenerator() as $i);
17
18?>
19--EXPECTF--
20Fatal error: Uncaught Error: Call to undefined function foo() in %s:%d
21Stack trace:
22#0 %s(%d): autoload('SyntaxError')
23#1 %s(%d): testGenerator()
24#2 {main}
25  thrown in %s on line %d
26