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 @@ -2793,6 +2793,20 @@ static zend_always_inline int _zend_update_type_info(
27932793 tmp &= ~MAY_BE_REF ;
27942794 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 ;
27952795 }
2796+ if ((tmp & (MAY_BE_RC1 |MAY_BE_RCN )) == MAY_BE_RCN ) {
2797+ /* refcount may be indirectly decremented. Make an exception if the result is used in the next instruction */
2798+ if (!ssa_opcodes ) {
2799+ if (ssa -> vars [ssa_op -> result_def ].use_chain < 0
2800+ || opline + 1 != op_array -> opcodes + ssa -> vars [ssa_op -> result_def ].use_chain ) {
2801+ tmp |= MAY_BE_RC1 ;
2802+ }
2803+ } else {
2804+ if (ssa -> vars [ssa_op -> result_def ].use_chain < 0
2805+ || opline + 1 != ssa_opcodes [ssa -> vars [ssa_op -> result_def ].use_chain ]) {
2806+ tmp |= MAY_BE_RC1 ;
2807+ }
2808+ }
2809+ }
27962810 UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
27972811 COPY_SSA_OBJ_TYPE (ssa_op -> op2_use , ssa_op -> result_def );
27982812 }
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