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