File tree 2 files changed +31
-3
lines changed
2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -3312,10 +3312,18 @@ static zend_always_inline int _zend_update_type_info(
3312
3312
zend_uchar opcode ;
3313
3313
3314
3314
if (!ssa_opcodes ) {
3315
- ZEND_ASSERT (j == (opline - op_array -> opcodes ) + 1 && "Use must be in next opline" );
3315
+ if (j != (opline - op_array -> opcodes ) + 1 ) {
3316
+ /* Use must be in next opline */
3317
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
3318
+ break ;
3319
+ }
3316
3320
opcode = op_array -> opcodes [j ].opcode ;
3317
3321
} else {
3318
- ZEND_ASSERT (ssa_opcodes [j ] == opline + 1 && "Use must be in next opline" );
3322
+ if (ssa_opcodes [j ] != opline + 1 ) {
3323
+ /* Use must be in next opline */
3324
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
3325
+ break ;
3326
+ }
3319
3327
opcode = ssa_opcodes [j ]-> opcode ;
3320
3328
}
3321
3329
switch (opcode ) {
@@ -3374,7 +3382,10 @@ static zend_always_inline int _zend_update_type_info(
3374
3382
EMPTY_SWITCH_DEFAULT_CASE ()
3375
3383
}
3376
3384
j = zend_ssa_next_use (ssa -> ops , ssa_op -> result_def , j );
3377
- ZEND_ASSERT (j < 0 && "There should only be one use" );
3385
+ if (j >= 0 ) {
3386
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
3387
+ break ;
3388
+ }
3378
3389
}
3379
3390
}
3380
3391
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