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