summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c6
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);