diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index da5bd46d99b..c75857610a0 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -3109,7 +3109,8 @@ static int zend_update_type_info(const zend_op_array *op_array, UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def); } else { /* invalid key type */ - UPDATE_SSA_TYPE(t1, ssa_ops[i].op1_def); + tmp = (tmp & (MAY_BE_RC1|MAY_BE_RCN)) | (t1 & ~(MAY_BE_RC1|MAY_BE_RCN)); + UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def); } COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def); } diff --git a/ext/opcache/tests/ssa_bug_011.phpt b/ext/opcache/tests/ssa_bug_011.phpt new file mode 100644 index 00000000000..58f39807fc6 --- /dev/null +++ b/ext/opcache/tests/ssa_bug_011.phpt @@ -0,0 +1,19 @@ +--TEST-- +Type inference warning +--FILE-- + 1, + ); + } +} +?> +OK +--EXPECT-- +OK