]> granicus.if.org Git - php/commitdiff
Fixed bug #74836 (isset on zero-prefixed numeric indexes in array broken)
authorDmitry Stogov <dmitry@zend.com>
Tue, 4 Jul 2017 04:23:46 +0000 (07:23 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 4 Jul 2017 04:23:46 +0000 (07:23 +0300)
NEWS
Zend/tests/bug74836.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 26d09174b9d0268f82a6e133b170ea66b367fbf5..f30825c982b8f7c5e32454559c02cea99555d8c6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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).
diff --git a/Zend/tests/bug74836.phpt b/Zend/tests/bug74836.phpt
new file mode 100644 (file)
index 0000000..7281a07
--- /dev/null
@@ -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)