Skip to content

Commit 3e82816

Browse files
committed
Fixed bug #69125 (Array numeric string as key)
1 parent e441d71 commit 3e82816

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PHP NEWS
2121
. Fixed bug #68964 (Allowed memory size exhausted with odbc_exec). (Anatol)
2222

2323
- Opcache:
24+
. Fixed bug #69125 (Array numeric string as key). (Laruence)
2425
. Fixed bug #69038 (switch(SOMECONSTANT) misbehaves). (Laruence)
2526

2627
- OpenSSL:

ext/opcache/Optimizer/zend_optimizer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ static void update_op2_const(zend_op_array *op_array,
241241
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
242242
case ZEND_ADD_ARRAY_ELEMENT:
243243
case ZEND_INIT_ARRAY:
244+
case ZEND_ASSIGN_DIM:
244245
case ZEND_UNSET_DIM:
245246
case ZEND_FETCH_DIM_R:
246247
case ZEND_FETCH_DIM_W:

ext/opcache/tests/bug69125.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #69125 (Array numeric string as key)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
--SKIPIF--
7+
<?php require_once('skipif.inc'); ?>
8+
--FILE--
9+
<?php
10+
11+
const SZERO = '0';
12+
const SONE = '1';
13+
14+
$array[SZERO] = "okey";
15+
$array[1] = "okey";
16+
17+
var_dump($array[SZERO]);
18+
var_dump($array[SONE]);
19+
?>
20+
--EXPECT--
21+
string(4) "okey"
22+
string(4) "okey"

0 commit comments

Comments
 (0)