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 @@ -2816,6 +2816,20 @@ static zend_always_inline zend_result _zend_update_type_info(
28162816 tmp &= ~MAY_BE_REF ;
28172817 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 ;
28182818 }
2819+ if ((tmp & (MAY_BE_RC1 |MAY_BE_RCN )) == MAY_BE_RCN ) {
2820+ /* refcount may be indirectly decremented. Make an exception if the result is used in the next instruction */
2821+ if (!ssa_opcodes ) {
2822+ if (ssa -> vars [ssa_op -> result_def ].use_chain < 0
2823+ || opline + 1 != op_array -> opcodes + ssa -> vars [ssa_op -> result_def ].use_chain ) {
2824+ tmp |= MAY_BE_RC1 ;
2825+ }
2826+ } else {
2827+ if (ssa -> vars [ssa_op -> result_def ].use_chain < 0
2828+ || opline + 1 != ssa_opcodes [ssa -> vars [ssa_op -> result_def ].use_chain ]) {
2829+ tmp |= MAY_BE_RC1 ;
2830+ }
2831+ }
2832+ }
28192833 UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
28202834 COPY_SSA_OBJ_TYPE (ssa_op -> op2_use , ssa_op -> result_def );
28212835 }
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