diff options
author | Stanislav Malyshev <stas@php.net> | 2012-05-01 23:51:41 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2012-05-01 23:54:10 -0700 |
commit | 7bbd5521d28ee77c5a8df80174f52dad0112e872 (patch) | |
tree | b35898ffd46a9c68d42a12f775b9a4e83b8379b6 /ext/json/json.c | |
parent | 93192ec56df762341125f257cc61ab0c3e64ea76 (diff) | |
download | php-git-7bbd5521d28ee77c5a8df80174f52dad0112e872.tar.gz |
Revert "Fix bug #61537 (json_encode() incorrectly truncates/discards information) and"
This reverts commit cb2a1c71c96d7c9b2ee03d77beae0c8e0d385f1b.
The fix is not correct, not fixed after discussion on github.
Please fix the issues and reapply the patch
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index 853611e7aa..fc1fcb7f1f 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -96,7 +96,6 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); @@ -390,7 +389,9 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } if (ulen < 0) { JSON_G(error_code) = PHP_JSON_ERROR_UTF8; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); + 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); @@ -688,11 +689,7 @@ static PHP_FUNCTION(json_encode) php_json_encode(&buf, parameter, options TSRMLS_CC); - if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && options ^ PHP_JSON_PARTIAL_OUTPUT_ON_ERROR) { - ZVAL_FALSE(return_value); - } else { - ZVAL_STRINGL(return_value, buf.c, buf.len, 1); - } + ZVAL_STRINGL(return_value, buf.c, buf.len, 1); smart_str_free(&buf); } |