diff options
author | Scott MacVicar <scottmac@php.net> | 2008-12-24 18:09:09 +0000 |
---|---|---|
committer | Scott MacVicar <scottmac@php.net> | 2008-12-24 18:09:09 +0000 |
commit | 7fe245af8513f0a3d6410480022c7d10e01a99b5 (patch) | |
tree | 8f13f742af59e1dd8d1f4b1c7803648f67039b57 /ext/json/json.c | |
parent | db73c5ec74449c697c22eb71c7252def4e20eed8 (diff) | |
download | php-git-7fe245af8513f0a3d6410480022c7d10e01a99b5.tar.gz |
MFH Make sure we clear out the error when the scalar version decoding works.
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index b3049d002d..e07a1a4ff5 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -531,6 +531,8 @@ static PHP_FUNCTION(json_decode) RETVAL_NULL(); if (str_len == 4) { if (!strcasecmp(str, "null")) { + /* We need to explicitly clear the error because its an actual NULL and not an error */ + jp->error_code = PHP_JSON_ERROR_NONE; RETVAL_NULL(); } else if (!strcasecmp(str, "true")) { RETVAL_BOOL(1); @@ -547,6 +549,10 @@ static PHP_FUNCTION(json_decode) } } + if (Z_TYPE_P(return_value) != IS_NULL) { + jp->error_code = PHP_JSON_ERROR_NONE; + } + zval_dtor(z); } FREE_ZVAL(z); |