Fixed bug #74836 (isset on zero-prefixed numeric indexes in array broken)

This commit is contained in:
Dmitry Stogov 2017-07-04 07:23:46 +03:00
parent 02ef5d3803
commit bfa24e3488
2 changed files with 35 additions and 0 deletions

2
NEWS
View File

@ -11,6 +11,8 @@ PHP NEWS
. Added object type annotation. (brzuchal)
. Fixed bug #74815 (crash with a combination of INI entries at startup).
(Anatol)
. Fixed bug #74836 (isset on zero-prefixed numeric indexes in array broken).
(Dmitry)
- CLI:
. Fixed bug #74849 (Process is started as interactive shell in PhpStorm).

33
Zend/tests/bug74836.phpt Normal file
View File

@ -0,0 +1,33 @@
--TEST--
Bug #74836 (isset on zero-prefixed numeric indexes in array broken)
--FILE--
<?php
$s = "1234567890a";
$a[10] = "42";
$i = "010";
var_dump($s["10"], isset($s["10"]));
var_dump($s["010"], isset($s["010"]));
var_dump($s[$i], isset($s[$i]));
var_dump($a["10"], isset($a["10"]));
var_dump($a["010"], isset($a["010"]));
var_dump($a[$i], isset($a[$i]));
?>
--EXPECTF--
string(1) "a"
bool(true)
string(1) "a"
bool(true)
string(1) "a"
bool(true)
string(2) "42"
bool(true)
Notice: Undefined index: 010 in %s on line %d
NULL
bool(false)
Notice: Undefined index: 010 in %s on line %d
NULL
bool(false)