Skip to content

Commit a89546d

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Handle FETCH_DIM_R after FETCH_DIM_FUNC_ARG in inference
2 parents 3d38960 + 2e29817 commit a89546d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,6 +3422,7 @@ static zend_always_inline int _zend_update_type_info(
34223422
* is already an object. */
34233423
break;
34243424
case ZEND_SEND_VAR:
3425+
case ZEND_FETCH_DIM_R:
34253426
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
34263427
* behind, because it can't be converted to DIM_FETCH_R. */
34273428
break;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
FETCH_DIM_FUNC_ARG that cannot be optimized to FETCH_DIM_R because it appends
3+
--FILE--
4+
<?php
5+
function test($x) {
6+
test($x[][$y]);
7+
}
8+
try {
9+
test([]);
10+
} catch (Error $e) {
11+
echo $e->getMessage(), "\n";
12+
}
13+
?>
14+
--EXPECT--
15+
Cannot use [] for reading

0 commit comments

Comments
 (0)