File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -3227,7 +3227,12 @@ static zend_always_inline int _zend_update_type_info(
32273227 tmp |= t1 & (MAY_BE_RC1 |MAY_BE_RCN );
32283228 }
32293229 if (opline -> op2_type == IS_UNUSED ) {
3230- key_type |= MAY_BE_HASH_ONLY (t1 ) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG ;
3230+ if (t1 & (MAY_BE_UNDEF |MAY_BE_NULL )) {
3231+ key_type |= MAY_BE_ARRAY_PACKED ;
3232+ }
3233+ if (t1 & MAY_BE_ARRAY ) {
3234+ key_type |= MAY_BE_HASH_ONLY (t1 ) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG ;
3235+ }
32313236 } else {
32323237 if (t2 & (MAY_BE_LONG |MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_RESOURCE |MAY_BE_DOUBLE )) {
32333238 key_type |= MAY_BE_HASH_ONLY (t1 ) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG ;
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Type inference 007: Incorrect array key type inference
3+ --INI--
4+ opcache.enable=1
5+ opcache.enable_cli=1
6+ opcache.optimization_level=-1
7+ --FILE--
8+ <?php
9+ function y () {
10+ for (;;) {
11+ s ($ array []);
12+ $ array = array ("" =>"" );
13+ }
14+ }
15+ ?>
16+ DONE
17+ --EXPECT--
18+ DONE
You can’t perform that action at this time.
0 commit comments