From ecb9d8019c4d63ad483fc8d1955e4e2de92a8a6f Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 21 Feb 2011 08:09:02 +0000 Subject: Fix Bug #54058, invalid utf-8 doesn't set json_encode() in all cases --- ext/json/tests/bug54058.phpt | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ext/json/tests/bug54058.phpt (limited to 'ext/json/tests') diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt new file mode 100644 index 0000000000..3b1136bdd9 --- /dev/null +++ b/ext/json/tests/bug54058.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #54058 (json_last_error() invalid UTF-8 produces wrong error) +--SKIPIF-- + +--FILE-- +foo = quoted_printable_decode('=B0'); +json_encode($a); +var_dump(json_last_error()); + +$b = new stdclass; +$b->foo = $bad_utf8; +$b->bar = 1; +json_encode($b); +var_dump(json_last_error()); + +$c = array( + 'foo' => $bad_utf8, + 'bar' => 1 +); +json_encode($c); +var_dump(json_last_error()); +?> +--EXPECTF-- +int(5) +int(5) +int(5) +int(5) -- cgit v1.2.1