diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 727022472bf5..024a5d0e194d 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -2359,6 +2359,9 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin if (ssa_ops[idx].op2_use >= 0 && ssa_ops[idx].op2_def >= 0) { ssa_var_info[ssa_ops[idx].op2_def] = ssa_var_info[ssa_ops[idx].op2_use]; } + if (ssa_ops[idx].result_use >= 0 && ssa_ops[idx].result_def >= 0) { + ssa_var_info[ssa_ops[idx].result_def] = ssa_var_info[ssa_ops[idx].result_use]; + } } else { if (zend_update_type_info(op_array, tssa, script, (zend_op*)opline, ssa_ops + idx, ssa_opcodes, optimization_level) == FAILURE) { // TODO: diff --git a/ext/opcache/tests/jit/gh22004.phpt b/ext/opcache/tests/jit/gh22004.phpt new file mode 100644 index 000000000000..bb60868a269f --- /dev/null +++ b/ext/opcache/tests/jit/gh22004.phpt @@ -0,0 +1,63 @@ +--TEST-- +GH-22004: ZEND_FE_FETCH_R with key operand +--CREDITS-- +YuanchengJiang +--FILE-- + $line) { + } + } +} +$iter = 20; +doRandom($iter); + +?> +==DONE== +--EXPECTF-- +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d + +Warning: Undefined variable $nLines in %s on line %d +==DONE==