diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 35f84a6d935..6c8e7f020f2 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -826,6 +826,8 @@ done: /* The use might have been optimized away, in which case we will hit the def * instead. */ if (use_opline->opcode == ZEND_COPY_TMP && use_opline->result.var == rt_var_num) { + start = def_opline + 1 - op_array->opcodes; + emit_live_range_raw(op_array, var_num, kind, start, end); return; } } while (!( diff --git a/ext/opcache/tests/opt/coalesce_002.phpt b/ext/opcache/tests/opt/coalesce_002.phpt new file mode 100644 index 00000000000..c3a05d22e7a --- /dev/null +++ b/ext/opcache/tests/opt/coalesce_002.phpt @@ -0,0 +1,22 @@ +--TEST-- +COALESCE optimization +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--FILE-- + +--EXPECTF-- +Warning: Undefined variable $a in %scoalesce_002.php on line 3 + +Fatal error: Uncaught ArgumentCountError: var_dump() expects at least 1 argument, 0 given in %scoalesce_002.php:3 +Stack trace: +#0 %scoalesce_002.php(3): var_dump() +#1 %scoalesce_002.php(5): t() +#2 {main} + thrown in %scoalesce_002.php on line 3 \ No newline at end of file