com php-src: Improve fix for bug #74442: ext/opcache/Optimizer/ dfa_pass.c

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    6c2222796bc468cc3a1da95346e525bbfe8f6657
Author:    Nikita Popov <[email protected]>         Sat, 15 Apr 2017 01:39:33 +0200
Parents:   2135b057ec33bb480a10f642a3e42ba10364b81e
Branches:  PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=6c2222796bc468cc3a1da95346e525bbfe8f6657

Log:
Improve fix for bug #74442

Make the check less conservative to be consistent with the other
cases.

Bugs:
https://bugs.php.net/74442

Changed paths:
  M  ext/opcache/Optimizer/dfa_pass.c


Diff:
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c
index 027814b..3abf997 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.