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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index 3bbe532d97..395f11db53 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -230,7 +230,10 @@ static PHP_FUNCTION(json_encode)
ZVAL_FALSE(return_value);
} else {
smart_str_0(&buf); /* copy? */
- ZVAL_NEW_STR(return_value, buf.s);
+ if (buf.s) {
+ RETURN_NEW_STR(buf.s);
+ }
+ RETURN_EMPTY_STRING();
}
}
/* }}} */