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