xref: /PHP-8.3/ext/json/tests/bug54484.phpt (revision 32a1ebbd)
1--TEST--
2Bug #54484 (Empty string in json_decode doesn't reset json_last_error)
3--FILE--
4<?php
5json_decode('{"test":"test"}');
6var_dump(json_last_error());
7
8json_decode("");
9var_dump(json_last_error());
10
11json_decode("invalid json");
12var_dump(json_last_error());
13
14json_decode("\"\001 invalid json\"");
15var_dump(json_last_error());
16
17json_decode("");
18var_dump(json_last_error());
19?>
20--EXPECT--
21int(0)
22int(4)
23int(4)
24int(3)
25int(4)
26