Skip to content

Commit bfa24e3

Browse files
committed
Fixed bug #74836 (isset on zero-prefixed numeric indexes in array broken)
1 parent 02ef5d3 commit bfa24e3

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ PHP NEWS
1111
. Added object type annotation. (brzuchal)
1212
. Fixed bug #74815 (crash with a combination of INI entries at startup).
1313
(Anatol)
14+
. Fixed bug #74836 (isset on zero-prefixed numeric indexes in array broken).
15+
(Dmitry)
1416

1517
- CLI:
1618
. Fixed bug #74849 (Process is started as interactive shell in PhpStorm).

Zend/tests/bug74836.phpt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Bug #74836 (isset on zero-prefixed numeric indexes in array broken)
3+
--FILE--
4+
<?php
5+
$s = "1234567890a";
6+
$a[10] = "42";
7+
$i = "010";
8+
9+
var_dump($s["10"], isset($s["10"]));
10+
var_dump($s["010"], isset($s["010"]));
11+
var_dump($s[$i], isset($s[$i]));
12+
13+
var_dump($a["10"], isset($a["10"]));
14+
var_dump($a["010"], isset($a["010"]));
15+
var_dump($a[$i], isset($a[$i]));
16+
?>
17+
--EXPECTF--
18+
string(1) "a"
19+
bool(true)
20+
string(1) "a"
21+
bool(true)
22+
string(1) "a"
23+
bool(true)
24+
string(2) "42"
25+
bool(true)
26+
27+
Notice: Undefined index: 010 in %s on line %d
28+
NULL
29+
bool(false)
30+
31+
Notice: Undefined index: 010 in %s on line %d
32+
NULL
33+
bool(false)

0 commit comments

Comments
 (0)