summaryrefslogtreecommitdiff
path: root/ext/json/tests
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-05-27 16:31:35 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-05-27 16:31:35 +0000
commitfaae3e9ecf55bbdb2d0f217016e8b59114b58f4c (patch)
tree8795d04ac96b84c2243736ae385579268131b0e6 /ext/json/tests
parent2c5368c013f287ed8bc88ecd52c0350f420c9738 (diff)
downloadphp-git-faae3e9ecf55bbdb2d0f217016e8b59114b58f4c.tar.gz
Fixed bug #41504 (json_decode() incorrectly decodes JSON arrays with empty
string keys).
Diffstat (limited to 'ext/json/tests')
-rw-r--r--ext/json/tests/bug41504.phpt29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/json/tests/bug41504.phpt b/ext/json/tests/bug41504.phpt
new file mode 100644
index 0000000000..6e51bb91a9
--- /dev/null
+++ b/ext/json/tests/bug41504.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #41504 (json_decode() converts empty array keys to "_empty_")
+--FILE--
+<?php
+
+var_dump(json_decode('{"":"value"}', true));
+var_dump(json_decode('{"":"value", "key":"value"}', true));
+var_dump(json_decode('{"key":"value", "":"value"}', true));
+
+echo "Done\n";
+?>
+--EXPECT--
+array(1) {
+ [""]=>
+ string(5) "value"
+}
+array(2) {
+ [""]=>
+ string(5) "value"
+ ["key"]=>
+ string(5) "value"
+}
+array(2) {
+ ["key"]=>
+ string(5) "value"
+ [""]=>
+ string(5) "value"
+}
+Done \ No newline at end of file