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
commit3242016f283138486242e4c4f4c0b1a5ce2e000f (patch)
treefdf4ddbf946b8d6ac23cf1c0b9c311229c7d9d31 /ext/json/json.c
parent1b2d14c5e10cc024f97a257a00fbefdb3a906501 (diff)
downloadphp-git-3242016f283138486242e4c4f4c0b1a5ce2e000f.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 5f3e1a854b..ec76c1d5f3 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -431,7 +431,6 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR
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:
@@ -567,6 +566,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);