xref: /PHP-7.1/ext/json/tests/bug64874_part2.phpt (revision e5abc537)
1--TEST--
2Case-sensitivity part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly")
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip"; ?>
5--FILE--
6<?php
7function decode($json) {
8	var_dump(json_decode($json));
9	echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
10}
11
12// Only lowercase should work
13decode('true');
14decode('True');
15decode('[true]');
16decode('[True]');
17echo PHP_EOL;
18
19decode('false');
20decode('False');
21decode('[false]');
22decode('[False]');
23echo PHP_EOL;
24
25decode('null');
26decode('Null');
27decode('[null]');
28decode('[Null]');
29echo PHP_EOL;
30
31echo "Done\n";
32--EXPECT--
33bool(true)
34SUCCESS
35NULL
36ERROR
37array(1) {
38  [0]=>
39  bool(true)
40}
41SUCCESS
42NULL
43ERROR
44
45bool(false)
46SUCCESS
47NULL
48ERROR
49array(1) {
50  [0]=>
51  bool(false)
52}
53SUCCESS
54NULL
55ERROR
56
57NULL
58SUCCESS
59NULL
60ERROR
61array(1) {
62  [0]=>
63  NULL
64}
65SUCCESS
66NULL
67ERROR
68
69Done
70