File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -3583,10 +3583,18 @@ static zend_always_inline zend_result _zend_update_type_info(
3583
3583
uint8_t opcode ;
3584
3584
3585
3585
if (!ssa_opcodes ) {
3586
- ZEND_ASSERT (j == (opline - op_array -> opcodes ) + 1 && "Use must be in next opline" );
3586
+ if (j != (opline - op_array -> opcodes ) + 1 ) {
3587
+ /* Use must be in next opline */
3588
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
3589
+ break ;
3590
+ }
3587
3591
opcode = op_array -> opcodes [j ].opcode ;
3588
3592
} else {
3589
- ZEND_ASSERT (ssa_opcodes [j ] == opline + 1 && "Use must be in next opline" );
3593
+ if (ssa_opcodes [j ] != opline + 1 ) {
3594
+ /* Use must be in next opline */
3595
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
3596
+ break ;
3597
+ }
3590
3598
opcode = ssa_opcodes [j ]-> opcode ;
3591
3599
}
3592
3600
switch (opcode ) {
@@ -3648,7 +3656,10 @@ static zend_always_inline zend_result _zend_update_type_info(
3648
3656
EMPTY_SWITCH_DEFAULT_CASE ()
3649
3657
}
3650
3658
j = zend_ssa_next_use (ssa -> ops , ssa_op -> result_def , j );
3651
- ZEND_ASSERT (j < 0 && "There should only be one use" );
3659
+ if (j >= 0 ) {
3660
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
3661
+ break ;
3662
+ }
3652
3663
}
3653
3664
}
3654
3665
if (((tmp & MAY_BE_ARRAY ) && (tmp & MAY_BE_ARRAY_KEY_ANY ))
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Type inference 022: FETCH_DIM_W
3
+ --INI--
4
+ opcache.enable=1
5
+ opcache.enable_cli=1
6
+ opcache.optimization_level=-1
7
+ --FILE--
8
+ <?php
9
+ function &foo (&$ a , $ n ) {
10
+ foreach (array (0 ) as $ _ ) {
11
+ return $ a [$ n ];
12
+ }
13
+ }
14
+ ?>
15
+ DONE
16
+ --EXPECT--
17
+ DONE
You can’t perform that action at this time.
0 commit comments