Skip to content

Commit 6007eb7

Browse files
committed
Use new param API in json
1 parent ae1ecf1 commit 6007eb7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

Diff for: ext/json/json.c

+13-6
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,12 @@ static PHP_FUNCTION(json_encode)
226226
zend_long options = 0;
227227
zend_long depth = PHP_JSON_PARSER_DEFAULT_DEPTH;
228228

229-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|ll", &parameter, &options, &depth) == FAILURE) {
230-
return;
231-
}
229+
ZEND_PARSE_PARAMETERS_START(1, 3)
230+
Z_PARAM_ZVAL_DEREF(parameter)
231+
Z_PARAM_OPTIONAL
232+
Z_PARAM_LONG(options)
233+
Z_PARAM_LONG(depth)
234+
ZEND_PARSE_PARAMETERS_END();
232235

233236
php_json_encode_init(&encoder);
234237
encoder.max_depth = (int)depth;
@@ -259,9 +262,13 @@ static PHP_FUNCTION(json_decode)
259262
zend_long depth = PHP_JSON_PARSER_DEFAULT_DEPTH;
260263
zend_long options = 0;
261264

262-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|bll", &str, &str_len, &assoc, &depth, &options) == FAILURE) {
263-
return;
264-
}
265+
ZEND_PARSE_PARAMETERS_START(1, 4)
266+
Z_PARAM_STRING(str, str_len)
267+
Z_PARAM_OPTIONAL
268+
Z_PARAM_BOOL(assoc)
269+
Z_PARAM_LONG(depth)
270+
Z_PARAM_LONG(options)
271+
ZEND_PARSE_PARAMETERS_END();
265272

266273
JSON_G(error_code) = PHP_JSON_ERROR_NONE;
267274

0 commit comments

Comments
 (0)