xref: /PHP-7.2/Zend/tests/generators/bug65161.phpt (revision e97d5fab)
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 [internal function]: autoload('SyntaxError')
23#1 %s(%d): spl_autoload_call('SyntaxError')
24#2 %s(%d): testGenerator()
25#3 {main}
26  thrown in %s on line %d
27