Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -6673,6 +6673,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
&& (p+1)->op == ZEND_JIT_TRACE_VM) {
const zend_op *opline = (p+1)->opline - 1;
if (opline->result_type != IS_UNUSED) {
if (res_type == IS_UNDEF) {
res_type = IS_NULL;
}
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), res_type, 1);
}
}
Expand Down
39 changes: 39 additions & 0 deletions ext/opcache/tests/jit/gh16770.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--TEST--
GH-16770 (Tracing JIT type mismatch when returning UNDEF)
--INI--
opcache.jit=1254
opcache.jit_hot_loop=1
opcache.jit_buffer_size=32M
--EXTENSIONS--
opcache
--FILE--
<?php
function ret_undef($k) {
return $undefined;
}
for ($i = 0; $i < 10; $i++) {
$output = ret_undef($i);
}
var_dump($output);
?>
--EXPECTF--
Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d

Warning: Undefined variable $undefined in %s on line %d
NULL
Loading