Commit 3718d9ac22f for php
commit 3718d9ac22f461e8baa50f183f312cc16b045dcc
Merge: c182df964f0 bda25d40d40
Author: Jorg Sowa <jorg.sowa@gmail.com>
Date: Sun Dec 6 18:41:19 2026 +0100
Merge branch 'PHP-8.5' into PHP-8.6
# Conflicts:
# NEWS
diff --cc NEWS
index a937c1e08ab,0c32fa9abdf..3bb9f6ecb8c
--- a/NEWS
+++ b/NEWS
@@@ -29,6 -27,11 +29,8 @@@ PH
- Opcache:
. Fixed type inference of JIT trace after FE_FETCH_R[W] with identical
branches. (ilutov, Arnaud)
- . Fixed bug GH-26048 (Tracing JIT: segfault when a hooked property is passed
- as an argument to a run-time-resolved call (FETCH_OBJ_FUNC_ARG) in a hot
- loop). (David Carlier)
+ . Fixed missing "Undefined variable" warning for a dead array literal
+ element removed by DCE. (fQwQf)
- Reflection:
. Fixed bug GH-24729 (Use-after-free in
diff --cc Zend/Optimizer/dce.c
index c1654b31392,34cae23b746..8223775013d
--- a/Zend/Optimizer/dce.c
+++ b/Zend/Optimizer/dce.c
@@@ -523,13 -516,15 +523,15 @@@ static inline bool may_break_varargs(co
}
if (ssa_op->result_def >= 0
&& ssa->vars[ssa_op->result_def].var < op_array->num_args) {
- return 1;
+ return true;
}
- return 0;
+ return false;
}
- static inline bool may_throw_dce_exception(const zend_op *opline) {
- return opline->opcode == ZEND_ADD_ARRAY_ELEMENT && opline->op2_type == IS_UNUSED;
+ static inline bool may_throw_dce_exception(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_ssa *ssa) {
+ return opline->opcode == ZEND_ADD_ARRAY_ELEMENT
+ && opline->op2_type == IS_UNUSED
+ && !(opline->op1_type == IS_CV && (ssa->var_info[ssa_op->op1_use].type & MAY_BE_UNDEF));
}
int dce_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *optimizer_ctx, zend_ssa *ssa, bool reorder_dtor_effects) {