xref: /PHP-7.4/ext/json/tests/bug43941.phpt (revision ded3d984)
1--TEST--
2Bug #43941 (json_encode() invalid UTF-8)
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(json_encode("abc"));
9var_dump(json_encode("ab\xE0"));
10var_dump(json_encode("ab\xE0", JSON_PARTIAL_OUTPUT_ON_ERROR));
11var_dump(json_encode(array("ab\xE0", "ab\xE0c", "abc"), JSON_PARTIAL_OUTPUT_ON_ERROR));
12
13echo "Done\n";
14?>
15--EXPECT--
16string(5) ""abc""
17bool(false)
18string(4) "null"
19string(17) "[null,null,"abc"]"
20Done
21