Merge branch 'PHP-7.0' into PHP-7.1

This commit is contained in:
Jakub Zelenka 2016-08-14 14:01:36 +01:00
commit 37c12f8f86
2 changed files with 25 additions and 0 deletions

View file

@ -258,6 +258,16 @@ static PHP_FUNCTION(json_decode)
RETURN_NULL();
}
if (depth <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be greater than zero");
RETURN_NULL();
}
if (depth > INT_MAX) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be lower than %d", INT_MAX);
RETURN_NULL();
}
/* For BC reasons, the bool $assoc overrides the long $options bit for PHP_JSON_OBJECT_AS_ARRAY */
if (assoc) {
options |= PHP_JSON_OBJECT_AS_ARRAY;