summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2009-05-14 22:02:08 +0000
committerScott MacVicar <scottmac@php.net>2009-05-14 22:02:08 +0000
commitd2a7785878c37fc7b4eac25b5649cade5b745f01 (patch)
tree69dbd3c1f8ec8cb6f4fbff13301ca30aea0a2f16 /ext/json/json.c
parentc0ce0e793289b4657380412c39314546b463956b (diff)
downloadphp-git-d2a7785878c37fc7b4eac25b5649cade5b745f01.tar.gz
MFH Allow a custom recursion depth to be specified for json_decode()
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index 42721edac6..a30d13ed36 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -494,7 +494,7 @@ static PHP_FUNCTION(json_decode)
char *str;
int str_len, utf16_len;
zend_bool assoc = 0; /* return JS objects as PHP objects by default */
- long depth = JSON_PARSER_MAX_DEPTH;
+ long depth = JSON_PARSER_DEFAULT_DEPTH;
zval *z;
unsigned short *utf16;
JSON_parser jp;
@@ -517,9 +517,9 @@ static PHP_FUNCTION(json_decode)
RETURN_NULL();
}
- /* can be removed once we remove the max depth limit */
- if (depth <= 0 || depth > JSON_PARSER_MAX_DEPTH) {
- depth = JSON_PARSER_MAX_DEPTH;
+ if (depth <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must greater than zero.");
+ RETURN_NULL();
}
ALLOC_INIT_ZVAL(z);