Skip to content

Commit f56371b

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix type inference
2 parents 65472c7 + 1b45efb commit f56371b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3253,7 +3253,7 @@ static zend_always_inline zend_result _zend_update_type_info(
32533253
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
32543254
}
32553255
if (opline->op2_type == IS_UNUSED) {
3256-
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL)) {
3256+
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
32573257
key_type |= MAY_BE_ARRAY_PACKED;
32583258
}
32593259
if (t1 & MAY_BE_ARRAY) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Type inference 010: FRTCH_DIM_W
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
function foo() {
10+
$x = false;
11+
$x[] = &$y;
12+
}
13+
foo();
14+
?>
15+
DONE
16+
--EXPECTF--
17+
Deprecated: Automatic conversion of false to array is deprecated in %sinference_010.php on line 4
18+
DONE

0 commit comments

Comments
 (0)