xref: /PHP-5.5/ext/json/tests/bug41504.phpt (revision 0f15eeda)
1--TEST--
2Bug #41504 (json_decode() converts empty array keys to "_empty_")
3--SKIPIF--
4<?php if (!extension_loaded('json')) print 'skip'; ?>
5--FILE--
6<?php
7
8var_dump(json_decode('{"":"value"}', true));
9var_dump(json_decode('{"":"value", "key":"value"}', true));
10var_dump(json_decode('{"key":"value", "":"value"}', true));
11
12echo "Done\n";
13?>
14--EXPECT--
15array(1) {
16  [""]=>
17  string(5) "value"
18}
19array(2) {
20  [""]=>
21  string(5) "value"
22  ["key"]=>
23  string(5) "value"
24}
25array(2) {
26  ["key"]=>
27  string(5) "value"
28  [""]=>
29  string(5) "value"
30}
31Done
32