From d526ddec85cd7070a08c85cc258a55e5ee649fdd Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 25 Sep 2017 12:03:47 +0300 Subject: [PATCH] Fixed type inference --- ext/opcache/Optimizer/zend_inference.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 508ba6c3a12..ecfb14ca370 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2331,12 +2331,14 @@ static int zend_update_type_info(const zend_op_array *op_array, } } else if (opline->extended_value == ZEND_ASSIGN_OBJ) { if (opline->op1_type == IS_CV) { - if (orig & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { - orig &= (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE); - orig |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN; - } - if (orig & MAY_BE_OBJECT) { - orig |= (MAY_BE_RC1|MAY_BE_RCN); + if (!(orig & MAY_BE_REF)) { + if (orig & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + orig &= (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE); + orig |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN; + } + if (orig & MAY_BE_OBJECT) { + orig |= (MAY_BE_RC1|MAY_BE_RCN); + } } UPDATE_SSA_TYPE(orig, ssa_ops[i].op1_def); COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);