diff options
author | Stanislav Malyshev <stas@php.net> | 2008-01-30 03:17:57 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2008-01-30 03:17:57 +0000 |
commit | b4443f35fff7c2b094f4ec6767f3838a4d7b5a7e (patch) | |
tree | 92f46120124ca94b142602854b4e03bf5011ca12 /ext/json/json.c | |
parent | 6a455ee097c45cbc35cfe38139eaade040b9082a (diff) | |
download | php-git-b4443f35fff7c2b094f4ec6767f3838a4d7b5a7e.tar.gz |
fix #43941: invalid utf-8 not accepted
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 10 |
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; } |