xref: /PHP-8.2/Zend/tests/gh8841.phpt (revision cf9b030a)
1--TEST--
2GH-8841 (php-cli core dump calling a badly formed function)
3--FILE--
4<?php
5register_shutdown_function(function() {
6    echo "Before calling g()\n";
7    g(1);
8    echo "After calling g()\n";
9});
10
11register_shutdown_function(function() {
12    echo "Before calling f()\n";
13    f(1);
14    echo "After calling f()\n";
15});
16
17eval('function g($x): int { return $x; }');
18eval('function f($x): void { return $x; }');
19?>
20--EXPECTF--
21Fatal error: A void function must not return a value in %s on line %d
22Before calling g()
23After calling g()
24Before calling f()
25
26Fatal error: Uncaught Error: Call to undefined function f() in %s:%d
27Stack trace:
28#0 [internal function]: {closure}()
29#1 {main}
30  thrown in %s on line %d
31