File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -2491,6 +2491,10 @@ static zend_always_inline int _zend_update_type_info(
2491
2491
tmp |= MAY_BE_RC1 | MAY_BE_RCN ;
2492
2492
} else {
2493
2493
tmp |= MAY_BE_RC1 ;
2494
+ if (opline -> extended_value == IS_ARRAY
2495
+ && (t1 & (MAY_BE_UNDEF |MAY_BE_NULL ))) {
2496
+ tmp |= MAY_BE_RCN ;
2497
+ }
2494
2498
}
2495
2499
}
2496
2500
if (opline -> extended_value == IS_ARRAY ) {
@@ -2500,7 +2504,7 @@ static zend_always_inline int _zend_update_type_info(
2500
2504
if (t1 & MAY_BE_OBJECT ) {
2501
2505
tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
2502
2506
} else {
2503
- tmp |= ((t1 & MAY_BE_ANY ) << MAY_BE_ARRAY_SHIFT ) | ((t1 & MAY_BE_ANY ) ? MAY_BE_ARRAY_PACKED : 0 );
2507
+ tmp |= ((t1 & ( MAY_BE_ANY - MAY_BE_NULL )) << MAY_BE_ARRAY_SHIFT ) | ((t1 & ( MAY_BE_ANY - MAY_BE_NULL ) ) ? MAY_BE_ARRAY_PACKED : 0 );
2504
2508
}
2505
2509
}
2506
2510
UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ JIT CAST: 001
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.jit=1205
9
+ ;opcache.jit_debug=1
10
+ --EXTENSIONS--
11
+ opcache
12
+ --FILE--
13
+ <?php
14
+ function foo (int $ x = null ) {
15
+ $ a = (array )$ x ;
16
+ $ a [] = 42 ;
17
+ var_dump ($ a );
18
+ }
19
+ foo (null );
20
+ ?>
21
+ --EXPECT--
22
+ array(1) {
23
+ [0]=>
24
+ int(42)
25
+ }
You can’t perform that action at this time.
0 commit comments