Skip to content

Commit dd73e5a

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fixed type inference
2 parents 8d55998 + cffba94 commit dd73e5a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,6 +2813,9 @@ static zend_always_inline zend_result _zend_update_type_info(
28132813
if (t1 & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_STRING)) {
28142814
tmp |= (OP1_DATA_INFO() & (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF));
28152815

2816+
if (OP1_DATA_INFO() & MAY_BE_UNDEF) {
2817+
tmp |= MAY_BE_NULL;
2818+
}
28162819
if (opline->op2_type == IS_UNUSED) {
28172820
/* When appending to an array and the LONG_MAX key is already used
28182821
* null will be returned. */
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 003
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=tracing
9+
--EXTENSIONS--
10+
opcache
11+
--FILE--
12+
<?php
13+
function test() {
14+
var_dump($a[0] = $v);
15+
}
16+
test();
17+
?>
18+
--EXPECTF--
19+
Warning: Undefined variable $v in %sassign_dim_003.php on line 3
20+
NULL

0 commit comments

Comments
 (0)