From: Dmitry Stogov Date: Mon, 10 Oct 2016 22:58:30 +0000 (+0300) Subject: Fixed referencecounter inference rules X-Git-Tag: php-7.2.0alpha1~1173^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fae7d6b9bbb3eaf053fb9eb43bc5ceabb34c87f7;p=php Fixed referencecounter inference rules --- diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 46153bc2ce..528f0d637b 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -358,8 +358,8 @@ static const func_info_t func_infos[] = { F1("strip_tags", MAY_BE_NULL | MAY_BE_STRING), F0("similar_text", MAY_BE_NULL | MAY_BE_LONG), F1("explode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("implode", MAY_BE_NULL | MAY_BE_STRING), - F1("join", MAY_BE_NULL | MAY_BE_STRING), + FN("implode", MAY_BE_NULL | MAY_BE_STRING), + FN("join", MAY_BE_NULL | MAY_BE_STRING), FN("setlocale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("localeconv", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), #if HAVE_NL_LANGINFO diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 0718a1c84f..b1984f40b2 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2506,6 +2506,10 @@ static void zend_update_type_info(const zend_op_array *op_array, (opline->extended_value == IS_ARRAY || opline->extended_value == IS_OBJECT)) { tmp |= MAY_BE_RCN; + } else if ((t1 & MAY_BE_STRING) && + (opline->op1_type == IS_CV) && + opline->extended_value == IS_STRING) { + tmp |= 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); @@ -2521,6 +2525,10 @@ static void zend_update_type_info(const zend_op_array *op_array, } else if ((opline->extended_value == IS_ARRAY || opline->extended_value == IS_OBJECT) && (tmp & (MAY_BE_ARRAY|MAY_BE_OBJECT))) { + tmp |= MAY_BE_RC1 | MAY_BE_RCN; + } else if (opline->extended_value == IS_STRING && + (t1 & MAY_BE_STRING) && + (opline->op1_type == IS_CV)) { tmp |= MAY_BE_RC1 | MAY_BE_RCN; } else { tmp |= MAY_BE_RC1;