@@ -5,29 +5,32 @@ json_validate() - Error handling
55
66require_once ("json_validate_requires.inc " );
77
8- // json_validate_trycatchdump("");
9- // json_validate_trycatchdump("-");
10- // json_validate_trycatchdump("", -1);
8+ json_validate_trycatchdump ("" );
9+ json_validate_trycatchdump ("- " );
10+ json_validate_trycatchdump ("" , -1 );
1111json_validate_trycatchdump ('{"key1":"value1", "value2"} ' , 2 );
12- // json_validate_trycatchdump('{"key1":"value1", "key2":"value2"}', 1);
13- // json_validate_trycatchdump('{"key1":"value1", "key2":"value2"}', 2);
14- // json_validate_trycatchdump("-", 0);
15- // json_validate_trycatchdump("-", 512, JSON_BIGINT_AS_STRING);
16- // json_validate_trycatchdump("-", 512, JSON_BIGINT_AS_STRING | JSON_INVALID_UTF8_IGNORE);
17- // json_validate_trycatchdump("-", 512, JSON_INVALID_UTF8_IGNORE);
18- // json_validate_trycatchdump("{}", 512, JSON_INVALID_UTF8_IGNORE);
12+ json_validate_trycatchdump ('{"key1":"value1", "key2":"value2"} ' , 1 );
13+ json_validate_trycatchdump ('{"key1":"value1", "key2":"value2"} ' , 2 );
14+ json_validate_trycatchdump ("- " , 0 );
15+ json_validate_trycatchdump ("- " , 512 , JSON_BIGINT_AS_STRING );
16+ json_validate_trycatchdump ("- " , 512 , JSON_BIGINT_AS_STRING | JSON_INVALID_UTF8_IGNORE );
17+ json_validate_trycatchdump ("- " , 512 , JSON_INVALID_UTF8_IGNORE );
18+ json_validate_trycatchdump ("{} " , 512 , JSON_INVALID_UTF8_IGNORE );
1919
2020?>
2121--EXPECTF--
2222bool(false)
2323int(4)
24- string(12 ) "Syntax error"
24+ string(29 ) "Syntax error near character 0 "
2525bool(false)
2626int(4)
27- string(12 ) "Syntax error"
27+ string(29 ) "Syntax error near character 0 "
2828bool(false)
2929int(4)
30- string(12) "Syntax error"
30+ string(29) "Syntax error near character 0"
31+ bool(false)
32+ int(4)
33+ string(30) "Syntax error near character 19"
3134bool(false)
3235int(1)
3336string(28) "Maximum stack depth exceeded"
4548string(8) "No error"
4649bool(false)
4750int(4)
48- string(12 ) "Syntax error"
51+ string(29 ) "Syntax error near character 0 "
4952bool(true)
5053int(0)
5154string(8) "No error"
0 commit comments