]> granicus.if.org Git - php/commitdiff
Fixed referencecounter inference rules
authorDmitry Stogov <dmitry@zend.com>
Mon, 10 Oct 2016 22:58:30 +0000 (01:58 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 10 Oct 2016 22:58:30 +0000 (01:58 +0300)
ext/opcache/Optimizer/zend_func_info.c
ext/opcache/Optimizer/zend_inference.c

index 46153bc2ce93e8294379b917dff896bda284ad5e..528f0d637bf34379273e459101497240affc1684 100644 (file)
@@ -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
index 0718a1c84f577dcda9fcc7c76cb29fa3aa3e2e4a..b1984f40b2a33031361cd1049e0d1db8389bd3b0 100644 (file)
@@ -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;