File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ PHP NEWS
21
21
- MySQLi:
22
22
. Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)
23
23
24
+ - Opcache:
25
+ . Fixed bug #77691 (Opcache passes wrong value for inline array push
26
+ assignments). (Nikita)
27
+
24
28
- sodium:
25
29
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
26
30
Original file line number Diff line number Diff line change @@ -1581,7 +1581,10 @@ static int replace_constant_operands(sccp_ctx *ctx) {
1581
1581
zend_ssa_remove_instr (ssa , opline , ssa_op );
1582
1582
removed_ops ++ ;
1583
1583
}
1584
- } else if (ssa_op -> op1_def == i ) {
1584
+ } else if (ssa_op -> op1_def == i &&
1585
+ (ssa_op -> result_def < 0 ||
1586
+ (ssa -> vars [ssa_op -> result_def ].use_chain < 0 &&
1587
+ ssa -> vars [ssa_op -> result_def ].phi_use_chain == NULL ))) {
1585
1588
/* Compound assign or incdec -> convert to direct ASSIGN */
1586
1589
1587
1590
/* Destroy previous op2 */
@@ -1595,10 +1598,8 @@ static int replace_constant_operands(sccp_ctx *ctx) {
1595
1598
ssa_op -> op2_use_chain = -1 ;
1596
1599
}
1597
1600
1598
- /* Mark result unused, if possible */
1599
- if (ssa_op -> result_def >= 0
1600
- && ssa -> vars [ssa_op -> result_def ].use_chain < 0
1601
- && ssa -> vars [ssa_op -> result_def ].phi_use_chain == NULL ) {
1601
+ /* We checked that result has no uses, mark unused */
1602
+ if (ssa_op -> result_def >= 0 ) {
1602
1603
if (opline -> result_type & (IS_TMP_VAR |IS_VAR )) {
1603
1604
zend_optimizer_remove_live_range_ex (op_array , opline -> result .var , var -> definition );
1604
1605
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #77691: Opcache passes wrong value for inline array push assignments
3
+ --FILE--
4
+ <?php
5
+
6
+ if (true ) {
7
+ function dump ($ str ) {
8
+ var_dump ($ str );
9
+ }
10
+ }
11
+
12
+ function test () {
13
+ $ array = [];
14
+ dump ($ array [] = 'test ' );
15
+ dump ($ array );
16
+ }
17
+
18
+ test ();
19
+
20
+ ?>
21
+ --EXPECT--
22
+ string(4) "test"
23
+ array(1) {
24
+ [0]=>
25
+ string(4) "test"
26
+ }
You can’t perform that action at this time.
0 commit comments