]> granicus.if.org Git - php/commitdiff
Fixed type inference
authorDmitry Stogov <dmitry@zend.com>
Mon, 25 Sep 2017 09:03:47 +0000 (12:03 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 25 Sep 2017 09:03:47 +0000 (12:03 +0300)
ext/opcache/Optimizer/zend_inference.c

index 508ba6c3a121251917f301c5c377d9d42e4a45da..ecfb14ca370a69bd52cfd77068ff95268d274ed1 100644 (file)
@@ -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);