Skip to content

Commit f1e6a7d

Browse files
committed
JIT: Fixed numeric string index handling
1 parent cd32b47 commit f1e6a7d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_strin
347347
if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
348348
retval = zend_hash_index_find(ht, idx);
349349
if (!retval) {
350-
if (UNEXPECTED(zend_undefined_index_write(ht, str) == FAILURE)) {
350+
if (UNEXPECTED(zend_undefined_offset_write(ht, idx) == FAILURE)) {
351351
return NULL;
352352
}
353353
retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
JIT FETCH_DIM_RW: 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+
--FILE--
9+
<?php
10+
$a = [];
11+
$k = "0";
12+
$a[$k]++;
13+
var_dump($a[$k]);
14+
?>
15+
--EXPECTF--
16+
Warning: Undefined array key 0 in %sfetch_dim_rw_002.php on line 4
17+
int(1)

0 commit comments

Comments
 (0)