Skip to content

Commit e69fb48

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Tracing JIT: Fixed FETCH_DIM_R with packed array and negative key
2 parents 984f9c4 + 4d4a175 commit e69fb48

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5058,7 +5058,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
50585058
| b >2 // NOT_FOUND
50595059
}
50605060
}
5061-
if (op1_info & MAY_BE_ARRAY_NUMERIC_HASH) {
5061+
if (!packed_loaded || (op1_info & MAY_BE_ARRAY_NUMERIC_HASH)) {
50625062
|4:
50635063
if (!op2_loaded) {
50645064
| // hval = Z_LVAL_P(dim);

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5536,7 +5536,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
55365536
| jmp >2 // NOT_FOUND
55375537
}
55385538
}
5539-
if (op1_info & MAY_BE_ARRAY_NUMERIC_HASH) {
5539+
if (!packed_loaded || (op1_info & MAY_BE_ARRAY_NUMERIC_HASH)) {
55405540
|4:
55415541
if (!op2_loaded) {
55425542
| // hval = Z_LVAL_P(dim);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
JIT FETCH_DIM_R: 005
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+
$gens = [];
14+
for ($i = 0; $i < 5; $i++) {
15+
$gens[] = $gens[-1];
16+
}
17+
var_dump($gens);
18+
?>
19+
--EXPECTF--
20+
Warning: Undefined array key -1 in %sfetch_dim_r_005.php on line 4
21+
22+
Warning: Undefined array key -1 in %sfetch_dim_r_005.php on line 4
23+
24+
Warning: Undefined array key -1 in %sfetch_dim_r_005.php on line 4
25+
26+
Warning: Undefined array key -1 in %sfetch_dim_r_005.php on line 4
27+
28+
Warning: Undefined array key -1 in %sfetch_dim_r_005.php on line 4
29+
array(5) {
30+
[0]=>
31+
NULL
32+
[1]=>
33+
NULL
34+
[2]=>
35+
NULL
36+
[3]=>
37+
NULL
38+
[4]=>
39+
NULL
40+
}

0 commit comments

Comments
 (0)