Skip to content

Commit 77781f0

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fixed type inference
2 parents 0c29d5e + 8c9b599 commit 77781f0

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,8 @@ static zend_always_inline zend_result _zend_update_type_info(
36803680
tmp &= ~MAY_BE_ARRAY_EMPTY;
36813681
}
36823682
}
3683-
if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY))
3683+
if (!(tmp & MAY_BE_ARRAY)
3684+
|| (tmp & MAY_BE_ARRAY_KEY_ANY)
36843685
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
36853686
|| opline->opcode == ZEND_FETCH_DIM_R
36863687
|| opline->opcode == ZEND_FETCH_DIM_IS
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Type inference 024: FETCH_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+
for ($cnt = 0; $cnt < 6; $cnt++) {
11+
$b = new SplFixedArray(1);
12+
$b[0] = $a;
13+
$g = &$b[0];
14+
$b = new SplFixedArray(1);
15+
$b[0] = $b;
16+
$g = &$b[0];
17+
}
18+
}
19+
@foo();
20+
?>
21+
DONE
22+
--EXPECT--
23+
DONE

0 commit comments

Comments
 (0)