diff options
author | Jakub Zelenka <bukka@php.net> | 2016-06-28 20:49:38 +0100 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2016-06-28 20:49:38 +0100 |
commit | bea131f0bcbf4d61dd5f8d814b865183f8f1b657 (patch) | |
tree | cd73940549df2b32832b3def306648a6379ea115 /ext/json/json.c | |
parent | 0a4f89bc292c3c82ff719cd79e66ef96c2079526 (diff) | |
download | php-git-bea131f0bcbf4d61dd5f8d814b865183f8f1b657.tar.gz |
Add return code from json API functions
It will allow fix few json bugs in a better way
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index 8bb5e51d41..e8b111b28c 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -184,13 +184,15 @@ static PHP_MINFO_FUNCTION(json) } /* }}} */ -PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options) /* {{{ */ +PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options) /* {{{ */ { php_json_encode_zval(buf, val, options); + + return JSON_G(error_code) > 0 ? FAILURE : SUCCESS; } /* }}} */ -PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth) /* {{{ */ +PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth) /* {{{ */ { php_json_parser parser; @@ -198,8 +200,11 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_l if (php_json_yyparse(&parser)) { JSON_G(error_code) = php_json_parser_error_code(&parser); - RETURN_NULL(); + RETVAL_NULL(); + return FAILURE; } + + return SUCCESS; } /* }}} */ |