summaryrefslogtreecommitdiff
path: root/ext/json/tests/bug41504.phpt
blob: 2724f1690be381a516e5627b51a55eea8b9e44e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--TEST--
Bug #41504 (json_decode() converts empty array keys to "_empty_")
--SKIPIF--
<?php if (!extension_loaded('json')) print 'skip'; ?>
--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