File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -2748,6 +2748,20 @@ static zend_always_inline int _zend_update_type_info(
27482748 tmp &= ~MAY_BE_REF ;
27492749 tmp |= MAY_BE_NULL |MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_LONG |MAY_BE_DOUBLE |MAY_BE_STRING |MAY_BE_RC1 |MAY_BE_RCN ;
27502750 }
2751+ if ((tmp & (MAY_BE_RC1 |MAY_BE_RCN )) == MAY_BE_RCN ) {
2752+ /* refcount may be indirectly decremented. Make an exception if the result is used in the next instruction */
2753+ if (!ssa_opcodes ) {
2754+ if (ssa -> vars [ssa_op -> result_def ].use_chain < 0
2755+ || opline + 1 != op_array -> opcodes + ssa -> vars [ssa_op -> result_def ].use_chain ) {
2756+ tmp |= MAY_BE_RC1 ;
2757+ }
2758+ } else {
2759+ if (ssa -> vars [ssa_op -> result_def ].use_chain < 0
2760+ || opline + 1 != ssa_opcodes [ssa -> vars [ssa_op -> result_def ].use_chain ]) {
2761+ tmp |= MAY_BE_RC1 ;
2762+ }
2763+ }
2764+ }
27512765 UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
27522766 COPY_SSA_OBJ_TYPE (ssa_op -> op2_use , ssa_op -> result_def );
27532767 }
Original file line number Diff line number Diff line change 1+ --TEST--
2+ JIT ASSIGN: incorrect reference counting
3+ --INI--
4+ opcache.enable=1
5+ opcache.enable_cli=1
6+ opcache.file_update_protection=0
7+ opcache.jit_buffer_size=1M
8+ opcache.protect_memory=1
9+ --FILE--
10+ <?php
11+ function foo (){
12+ for ($ cnt = 0 ; $ cnt < 6 ; $ cnt ++) {
13+ $ t [$ i = $ s ][] = [] > $ n [$ i = $ j ] = $ s = $ a . $ a = $ f ;
14+ }
15+ }
16+ @foo ();
17+ ?>
18+ DONE
19+ --EXPECT--
20+ DONE
You can’t perform that action at this time.
0 commit comments