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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index ddfbbe5d26..90e5955c09 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -269,8 +269,14 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options) /*
{
efree(utf16);
}
-
- smart_str_appendl(buf, "\"\"", 2);
+ if(len < 0) {
+ if(!PG(display_errors)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument");
+ }
+ smart_str_appendl(buf, "null", 4);
+ } else {
+ smart_str_appendl(buf, "\"\"", 2);
+ }
return;
}