1--TEST-- 2GH-8841 (php-cli core dump calling a badly formed function) 3--SKIPIF-- 4<?php 5$tracing = extension_loaded("Zend OPcache") 6 && ($conf = opcache_get_configuration()["directives"]) 7 && array_key_exists("opcache.jit", $conf) 8 && $conf["opcache.jit"] === "tracing"; 9if (PHP_OS_FAMILY === "Windows" && PHP_INT_SIZE == 8 && $tracing) { 10 $url = "https://github.com/php/php-src/pull/14919#issuecomment-2259003979"; 11 die("xfail Test fails on Windows x64 (VS17) and tracing JIT; see $url"); 12} 13?> 14--FILE-- 15<?php 16register_shutdown_function(function() { 17 echo "Before calling g()\n"; 18 g(1); 19 echo "After calling g()\n"; 20}); 21 22register_shutdown_function(function() { 23 echo "Before calling f()\n"; 24 f(1); 25 echo "After calling f()\n"; 26}); 27 28eval('function g($x): int { return $x; }'); 29eval('function f($x): void { return $x; }'); 30?> 31--EXPECTF-- 32Fatal error: A void function must not return a value in %s on line %d 33Before calling g() 34After calling g() 35Before calling f() 36 37Fatal error: Uncaught Error: Call to undefined function f() in %s:%d 38Stack trace: 39#0 [internal function]: {closure:%s:%d}() 40#1 {main} 41 thrown in %s on line %d 42