xref: /PHP-7.4/ext/json/tests/bug69187.phpt (revision 782352c5)
1--TEST--
2Bug #69187 json_last_error return BC in PHP7
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip"; ?>
5--FILE--
6<?php
7var_dump(json_decode(NULL));
8var_dump(json_last_error());
9var_dump(json_decode(FALSE));
10var_dump(json_last_error());
11var_dump(json_decode(""));
12var_dump(json_last_error());
13
14var_dump(json_decode(0));
15var_dump(json_last_error());
16var_dump(json_decode(1));
17var_dump(json_last_error());
18var_dump(json_decode(TRUE));
19var_dump(json_last_error());
20
21json_decode("\xED\xA0\xB4");
22var_dump(json_last_error());
23
24json_decode("\x00");
25var_dump(json_last_error());
26
27json_decode("\"\xED\xA0\xB4\"");
28var_dump(json_last_error());
29
30json_decode("\"\x00\"");
31var_dump(json_last_error());
32?>
33--EXPECT--
34NULL
35int(4)
36NULL
37int(4)
38NULL
39int(4)
40int(0)
41int(0)
42int(1)
43int(0)
44int(1)
45int(0)
46int(5)
47int(3)
48int(5)
49int(3)
50