1--TEST--
2json_validate() - Invalid UTF-8's
3--FILE--
4<?php
5
6require_once("json_validate_requires.inc");
7
8echo "Testing Invalid UTF-8" . PHP_EOL;
9
10
11json_validate_trycatchdump("\"a\xb0b\"");
12json_validate_trycatchdump("\"a\xd0\xf2b\"");
13json_validate_trycatchdump("\"\x61\xf0\x80\x80\x41\"");
14json_validate_trycatchdump("[\"\xc1\xc1\",\"a\"]");
15
16json_validate_trycatchdump("\"a\xb0b\"", 512, JSON_INVALID_UTF8_IGNORE);
17json_validate_trycatchdump("\"a\xd0\xf2b\"", 512, JSON_INVALID_UTF8_IGNORE);
18json_validate_trycatchdump("\"\x61\xf0\x80\x80\x41\"", 512, JSON_INVALID_UTF8_IGNORE);
19json_validate_trycatchdump("[\"\xc1\xc1\",\"a\"]", 512, JSON_INVALID_UTF8_IGNORE);
20
21?>
22--EXPECT--
23Testing Invalid UTF-8
24bool(false)
25int(5)
26string(56) "Malformed UTF-8 characters, possibly incorrectly encoded"
27bool(false)
28int(5)
29string(56) "Malformed UTF-8 characters, possibly incorrectly encoded"
30bool(false)
31int(5)
32string(56) "Malformed UTF-8 characters, possibly incorrectly encoded"
33bool(false)
34int(5)
35string(56) "Malformed UTF-8 characters, possibly incorrectly encoded"
36bool(true)
37int(0)
38string(8) "No error"
39bool(true)
40int(0)
41string(8) "No error"
42bool(true)
43int(0)
44string(8) "No error"
45bool(true)
46int(0)
47string(8) "No error"
48