From e1ce0a64ea4d4f33f9de736a8b7dfcaf391ee053 Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Tue, 6 Jul 2010 17:01:30 +0000 Subject: [PATCH] Fix bug #52262 - Invalid UTF-8 documents don't set an error code when they fail to decode. --- NEWS | 2 ++ ext/json/json.c | 1 + 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index b524920baa..cac6209eff 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Jul 2010, PHP 5.3.3 RC3 +- Fixed bug #52262 (json_decode() shows no errors on invalid UTF-8). + (Scott) - Fixed bug #52240 (hash_copy() does not copy the HMAC key, causes wrong results and PHP crashes). (Felipe) - Fixed bug #52238 (Crash when an Exception occured in iterator_to_array). diff --git a/ext/json/json.c b/ext/json/json.c index 09e874040a..38fd3aacfa 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -500,6 +500,7 @@ PHP_JSON_API void php_json_decode(zval *return_value, char *str, int str_len, ze if (utf16) { efree(utf16); } + JSON_G(error_code) = PHP_JSON_ERROR_UTF8; RETURN_NULL(); } -- 2.40.0