File tree 2 files changed +18
-1
lines changed
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(
111
111
case ZEND_ROPE_INIT :
112
112
case ZEND_ROPE_ADD :
113
113
case ZEND_INIT_ARRAY :
114
- case ZEND_ADD_ARRAY_ELEMENT :
115
114
case ZEND_SPACESHIP :
116
115
case ZEND_STRLEN :
117
116
case ZEND_COUNT :
@@ -128,6 +127,12 @@ static inline bool may_have_side_effects(
128
127
case ZEND_ARRAY_KEY_EXISTS :
129
128
/* No side effects */
130
129
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 ;
131
136
case ZEND_ROPE_END :
132
137
/* TODO: Rope dce optimization, see #76446 */
133
138
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