Skip to content

Commit c852e0f

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix type inference
2 parents 6deddd3 + 81cb005 commit c852e0f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3378,6 +3378,9 @@ static zend_always_inline int _zend_update_type_info(
33783378
opline->op1_type,
33793379
opline->result_type == IS_VAR,
33803380
opline->op2_type == IS_UNUSED);
3381+
if (opline->opcode == ZEND_FETCH_DIM_FUNC_ARG && (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE))) {
3382+
tmp |= MAY_BE_NULL;
3383+
}
33813384
if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
33823385
tmp |= MAY_BE_NULL;
33833386
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
JIT FETCH_DIM_FUNC_ARG: 002
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--SKIPIF--
9+
<?php require_once('skipif.inc'); ?>
10+
--FILE--
11+
<?php
12+
new class(true[""]) {
13+
}
14+
?>
15+
DONE
16+
--EXPECTF--
17+
Warning: Trying to access array offset on value of type bool in %sfetch_dim_func_arg_002.php on line 2
18+
DONE

0 commit comments

Comments
 (0)