summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
authorAaron Piotrowski <aaron@trowski.com>2016-07-03 22:42:10 -0500
committerAaron Piotrowski <aaron@trowski.com>2016-07-03 22:42:10 -0500
commitd9a9cf8ecaef891b2369969e9efe9f6261359158 (patch)
tree04bcc83b3c9be1924007e007e1f508f7229af7ab /ext/json/json.c
parent583386d59e6b362fe49e51594718a109d0c0cc2f (diff)
parentc2b29a58bc0916e248ba2584564558097b16b51f (diff)
downloadphp-git-d9a9cf8ecaef891b2369969e9efe9f6261359158.tar.gz
Merge branch 'master' into iterable
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index d3c6111d4d..e8b111b28c 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -33,14 +33,6 @@
#include "php_json_parser.h"
#include <zend_exceptions.h>
-#include <float.h>
-#if defined(DBL_MANT_DIG) && defined(DBL_MIN_EXP)
-#define NUM_BUF_SIZE (3 + DBL_MANT_DIG - DBL_MIN_EXP)
-#else
-#define NUM_BUF_SIZE 1080
-#endif
-
-
static PHP_MINFO_FUNCTION(json);
static PHP_FUNCTION(json_encode);
static PHP_FUNCTION(json_decode);
@@ -192,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;
@@ -206,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;
}
/* }}} */