Skip to content

Commit cffba94

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fixed type inference
2 parents 5860a39 + e588f24 commit cffba94

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
@@ -2791,6 +2791,9 @@ static zend_always_inline int _zend_update_type_info(
27912791
if (t1 & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_STRING)) {
27922792
tmp |= (OP1_DATA_INFO() & (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF));
27932793

2794+
if (OP1_DATA_INFO() & MAY_BE_UNDEF) {
2795+
tmp |= MAY_BE_NULL;
2796+
}
27942797
if (opline->op2_type == IS_UNUSED) {
27952798
/* When appending to an array and the LONG_MAX key is already used
27962799
* 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)