Closed
Description
Description
<?php
function test($cond): ?int {
if ($cond) {
$i = 'foo';
}
return $i;
}
var_dump(test(false));
var_dump(test(false));
With tracing JIT:
php: ext/opcache/jit/zend_jit_trace.c:348: zend_jit_trace_type_to_info_ex: Assertion `info & (1 << type)' failed.
Termsig=6
With function JIT:
Fatal error: Uncaught TypeError: test(): Return value must be of type ?int, null returned in test.php:7
But I expected this output instead:
Warning: Undefined variable $i in %s on line %d
Warning: Undefined variable $i in %s on line %d
NULL
Warning: Undefined variable $i in %s on line %d
Warning: Undefined variable $i in %s on line %d
NULL
Currently, this should emit 4 warnings, due to #16495. That should be changed in the future. Anyway, that's not the issue.
@dstogov I can have a look if you want, but it's going to take me longer. 🙂
PHP Version
PHP 8.4
Operating System
No response