1--TEST--
2json_encode() invalid UTF8
3--FILE--
4<?php
5function json_encode_invalid_utf8($str) {
6    var_dump(json_encode($str));
7    var_dump(json_encode($str, JSON_INVALID_UTF8_IGNORE));
8    var_dump(json_encode($str, JSON_INVALID_UTF8_SUBSTITUTE));
9    var_dump(json_encode($str, JSON_UNESCAPED_UNICODE));
10    var_dump(bin2hex(json_encode($str, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE)));
11}
12json_encode_invalid_utf8("\x61\xb0\x62");
13json_encode_invalid_utf8("\x61\xf0\x80\x80\x41");
14echo "Done\n";
15?>
16--EXPECT--
17bool(false)
18string(4) ""ab""
19string(10) ""a\ufffdb""
20bool(false)
21string(14) "2261efbfbd6222"
22bool(false)
23string(4) ""aA""
24string(10) ""a\ufffdA""
25bool(false)
26string(14) "2261efbfbd4122"
27Done
28