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 @@ -2478,6 +2478,10 @@ static zend_always_inline int _zend_update_type_info(
24782478 tmp |= MAY_BE_RC1 | MAY_BE_RCN ;
24792479 } else {
24802480 tmp |= MAY_BE_RC1 ;
2481+ if (opline -> extended_value == IS_ARRAY
2482+ && (t1 & (MAY_BE_UNDEF |MAY_BE_NULL ))) {
2483+ tmp |= MAY_BE_RCN ;
2484+ }
24812485 }
24822486 }
24832487 if (opline -> extended_value == IS_ARRAY ) {
@@ -2487,7 +2491,7 @@ static zend_always_inline int _zend_update_type_info(
24872491 if (t1 & MAY_BE_OBJECT ) {
24882492 tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
24892493 } else {
2490- tmp |= ((t1 & MAY_BE_ANY ) << MAY_BE_ARRAY_SHIFT ) | ((t1 & MAY_BE_ANY ) ? MAY_BE_ARRAY_PACKED : 0 );
2494+ tmp |= ((t1 & ( MAY_BE_ANY - MAY_BE_NULL )) << MAY_BE_ARRAY_SHIFT ) | ((t1 & ( MAY_BE_ANY - MAY_BE_NULL ) ) ? MAY_BE_ARRAY_PACKED : 0 );
24912495 }
24922496 }
24932497 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+ --SKIPIF--
11+ <?php require_once ('skipif.inc ' ); ?>
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