]> granicus.if.org Git - php/commitdiff
Improve fix for bug #74442
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Apr 2017 23:39:33 +0000 (01:39 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Apr 2017 23:39:33 +0000 (01:39 +0200)
Make the check less conservative to be consistent with the other
cases.

ext/opcache/Optimizer/dfa_pass.c

index 027814b5cd585fdcf72e7ce219a89d26116a6494..3abf997d8d6c66bcae67edc5de63a94fc1db8c53 100644 (file)
@@ -366,10 +366,11 @@ static zend_bool opline_supports_assign_contraction(
                        && (opline->op2_type != IS_CV || opline->op2.var != cv_var);
        }
 
-       if (opline->opcode == ZEND_CAST) {
+       if (opline->opcode == ZEND_CAST
+                       && (opline->extended_value == IS_ARRAY || opline->extended_value == IS_OBJECT)) {
                /* CAST to array/object may initialize the result to an empty array/object before
                 * reading the expression. */
-               return opline->extended_value != IS_ARRAY && opline->extended_value != IS_OBJECT;
+               return opline->op1_type != IS_CV || opline->op1.var != cv_var;
        }
 
        return 1;