File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,6 @@ static inline bool may_have_side_effects(
111111 case ZEND_ROPE_INIT :
112112 case ZEND_ROPE_ADD :
113113 case ZEND_INIT_ARRAY :
114- case ZEND_ADD_ARRAY_ELEMENT :
115114 case ZEND_SPACESHIP :
116115 case ZEND_STRLEN :
117116 case ZEND_COUNT :
@@ -128,6 +127,12 @@ static inline bool may_have_side_effects(
128127 case ZEND_ARRAY_KEY_EXISTS :
129128 /* No side effects */
130129 return 0 ;
130+ case ZEND_ADD_ARRAY_ELEMENT :
131+ /* TODO: We can't free two vars. Keep instruction alive. <?php [0, "$a" => "$b"]; */
132+ if ((opline -> op1_type & (IS_VAR |IS_TMP_VAR )) && (opline -> op2_type & (IS_VAR |IS_TMP_VAR ))) {
133+ return 1 ;
134+ }
135+ return 0 ;
131136 case ZEND_ROPE_END :
132137 /* TODO: Rope dce optimization, see #76446 */
133138 return 1 ;
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Incorrect DCE of ADD_ARRAY_ELEMENT
3+ --FILE--
4+ <?php
5+ [0 , "$ a " => "$ b " ];
6+ ?>
7+ DONE
8+ --EXPECTF--
9+ Warning: Undefined variable $a in %sdce_011.php on line 2
10+
11+ Warning: Undefined variable $b in %sdce_011.php on line 2
12+ DONE
You can’t perform that action at this time.
0 commit comments