summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2011-02-21 08:09:02 +0000
committerScott MacVicar <scottmac@php.net>2011-02-21 08:09:02 +0000
commitecb9d8019c4d63ad483fc8d1955e4e2de92a8a6f (patch)
tree87d99da6751af969be7203f904e74ef102816e5c /ext/json/json.c
parent2a6968e43ae4dc6b91c44f59daa94b3a2b26fd51 (diff)
downloadphp-git-ecb9d8019c4d63ad483fc8d1955e4e2de92a8a6f.tar.gz
Fix Bug #54058, invalid utf-8 doesn't set json_encode() in all cases
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index 2077051279..8a942a8655 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -538,7 +538,6 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio
PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC) /* {{{ */
{
- JSON_G(error_code) = PHP_JSON_ERROR_NONE;
switch (Z_TYPE_P(val))
{
case IS_NULL:
@@ -680,6 +679,8 @@ static PHP_FUNCTION(json_encode)
return;
}
+ JSON_G(error_code) = PHP_JSON_ERROR_NONE;
+
php_json_encode(&buf, parameter, options TSRMLS_CC);
ZVAL_STRINGL(return_value, buf.c, buf.len, 1);