From: Sara Golemon Date: Sat, 31 Dec 2016 00:40:45 +0000 (-0800) Subject: Use new param API in standard/string X-Git-Tag: php-7.2.0alpha1~715 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=331dcf08df14177c79eaf05acd087168564ec9dd;p=php Use new param API in standard/string --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 1a1ee36dba..a4bb111caa 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -254,9 +254,9 @@ PHP_FUNCTION(bin2hex) zend_string *result; zend_string *data; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(data) + ZEND_PARSE_PARAMETERS_END(); result = php_bin2hex((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data)); @@ -274,9 +274,9 @@ PHP_FUNCTION(hex2bin) { zend_string *result, *data; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(data) + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(data) % 2 != 0) { php_error_docref(NULL, E_WARNING, "Hexadecimal input string must have an even length"); @@ -299,10 +299,13 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / zend_string *s11, *s22; zend_long start = 0, len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|ll", &s11, - &s22, &start, &len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(s11) + Z_PARAM_STR(s22) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(start) + Z_PARAM_LONG(len) + ZEND_PARSE_PARAMETERS_END(); if (ZEND_NUM_ARGS() < 4) { len = ZSTR_LEN(s11); @@ -542,9 +545,9 @@ PHP_FUNCTION(nl_langinfo) zend_long item; char *value; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &item) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(item) + ZEND_PARSE_PARAMETERS_END(); switch(item) { /* {{{ */ #ifdef ABDAY_1 @@ -729,9 +732,10 @@ PHP_FUNCTION(strcoll) { zend_string *s1, *s2; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &s1, &s2) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(s1) + Z_PARAM_STR(s2) + ZEND_PARSE_PARAMETERS_END(); RETURN_LONG(strcoll((const char *) ZSTR_VAL(s1), (const char *) ZSTR_VAL(s2))); @@ -945,9 +949,13 @@ PHP_FUNCTION(wordwrap) zend_bool docut = 0; zend_string *newtext; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lsb", &text, &linelength, &breakchar, &breakchar_len, &docut) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(text) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(linelength) + Z_PARAM_STRING(breakchar, breakchar_len) + Z_PARAM_BOOL(docut) + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(text) == 0) { RETURN_EMPTY_STRING(); @@ -1598,9 +1606,11 @@ PHP_FUNCTION(basename) char *string, *suffix = NULL; size_t string_len, suffix_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(string, string_len) + Z_PARAM_OPTIONAL + Z_PARAM_STRING(suffix, suffix_len) + ZEND_PARSE_PARAMETERS_END(); RETURN_STR(php_basename(string, string_len, suffix, suffix_len)); } @@ -1623,9 +1633,11 @@ PHP_FUNCTION(dirname) zend_string *ret; zend_long levels = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &levels) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(str, str_len) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(levels) + ZEND_PARSE_PARAMETERS_END(); ret = zend_string_init(str, str_len, 0); @@ -1666,9 +1678,11 @@ PHP_FUNCTION(pathinfo) zend_long opt = PHP_PATHINFO_ALL; zend_string *ret = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &path, &path_len, &opt) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(path, path_len) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(opt) + ZEND_PARSE_PARAMETERS_END(); have_basename = ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME); @@ -1826,9 +1840,12 @@ PHP_FUNCTION(stristr) char needle_char[2]; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|b", &haystack, &needle, &part) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(haystack) + Z_PARAM_ZVAL_DEREF(needle) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(part) + ZEND_PARSE_PARAMETERS_END(); haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); @@ -1878,9 +1895,12 @@ PHP_FUNCTION(strstr) zend_long found_offset; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|b", &haystack, &needle, &part) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(haystack) + Z_PARAM_ZVAL_DEREF(needle) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(part) + ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE_P(needle) == IS_STRING) { if (!Z_STRLEN_P(needle)) { @@ -1980,9 +2000,12 @@ PHP_FUNCTION(stripos) zval *needle; zend_string *needle_dup = NULL, *haystack_dup; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &haystack, &needle, &offset) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(haystack) + Z_PARAM_ZVAL_DEREF(needle) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(offset) + ZEND_PARSE_PARAMETERS_END(); if (offset < 0) { offset += (zend_long)ZSTR_LEN(haystack); @@ -2108,10 +2131,12 @@ PHP_FUNCTION(strripos) zend_string *needle_dup, *haystack_dup, *ord_needle = NULL; ALLOCA_FLAG(use_heap); - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &haystack, &zneedle, &offset) == FAILURE) { - RETURN_FALSE; - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(haystack) + Z_PARAM_ZVAL_DEREF(zneedle) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(offset) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap); if (Z_TYPE_P(zneedle) == IS_STRING) { @@ -2212,9 +2237,10 @@ PHP_FUNCTION(strrchr) const char *found = NULL; zend_long found_offset; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &haystack, &needle) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(haystack) + Z_PARAM_ZVAL_DEREF(needle) + ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE_P(needle) == IS_STRING) { found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack)); @@ -2296,9 +2322,12 @@ PHP_FUNCTION(chunk_split) zend_long chunklen = 76; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls", &str, &chunklen, &end, &endlen) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(str) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(chunklen) + Z_PARAM_STRING(end, endlen) + ZEND_PARSE_PARAMETERS_END(); if (chunklen <= 0) { php_error_docref(NULL, E_WARNING, "Chunk length should be greater than zero"); @@ -2406,9 +2435,13 @@ PHP_FUNCTION(substr_replace) HashPosition from_idx, repl_idx, len_idx; zval *tmp_str = NULL, *tmp_from = NULL, *tmp_repl = NULL, *tmp_len= NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzz|z/", &str, &repl, &from, &len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_ZVAL_DEREF(str) + Z_PARAM_ZVAL_DEREF(repl) + Z_PARAM_ZVAL_DEREF(from) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_DEREF_EX(len, 0, 1) + ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE_P(str) != IS_ARRAY) { convert_to_string_ex(str); @@ -2658,9 +2691,9 @@ PHP_FUNCTION(quotemeta) char c; zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &old) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(old) + ZEND_PARSE_PARAMETERS_END(); old_end = ZSTR_VAL(old) + ZSTR_LEN(old); @@ -2784,9 +2817,9 @@ PHP_FUNCTION(lcfirst) { zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(str) + ZEND_PARSE_PARAMETERS_END(); if (!ZSTR_LEN(str)) { RETURN_EMPTY_STRING(); @@ -3455,9 +3488,9 @@ PHP_FUNCTION(strrev) char *e, *p; zend_string *n; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(str) + ZEND_PARSE_PARAMETERS_END(); n = zend_string_alloc(ZSTR_LEN(str), 0); p = ZSTR_VAL(n); @@ -3529,9 +3562,12 @@ PHP_FUNCTION(similar_text) int ac = ZEND_NUM_ARGS(); size_t sim; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|z/", &t1, &t2, &percent) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(t1) + Z_PARAM_STR(t2) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_DEREF_EX(percent, 0, 1) + ZEND_PARSE_PARAMETERS_END(); if (ac > 2) { convert_to_double_ex(percent); @@ -3598,9 +3634,10 @@ PHP_FUNCTION(addcslashes) { zend_string *str, *what; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &str, &what) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(str) + Z_PARAM_STR(what) + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(str) == 0) { RETURN_EMPTY_STRING(); @@ -3638,9 +3675,9 @@ PHP_FUNCTION(stripcslashes) { zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(str) + ZEND_PARSE_PARAMETERS_END(); ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str)); php_stripcslashes(Z_STR_P(return_value)); @@ -3653,9 +3690,9 @@ PHP_FUNCTION(stripslashes) { zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(str) + ZEND_PARSE_PARAMETERS_END(); ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str)); php_stripslashes(Z_STR_P(return_value)); @@ -4119,9 +4156,11 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) size_t str_len; zend_string *broken_str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &max_chars) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(str, str_len) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(max_chars) + ZEND_PARSE_PARAMETERS_END(); if (str_len == 0) { RETURN_FALSE; @@ -4385,9 +4424,11 @@ PHP_FUNCTION(strip_tags) char *allowed_tags=NULL; size_t allowed_tags_len=0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z", &str, &allow) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(str) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_DEREF(allow) + ZEND_PARSE_PARAMETERS_END(); /* To maintain a certain BC, we allow anything for the second parameter and return original string */ if (allow) { @@ -4414,9 +4455,10 @@ PHP_FUNCTION(setlocale) int num_args, i = 0; uint32_t idx; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l+", &cat, &args, &num_args) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, -1) + Z_PARAM_LONG(cat) + Z_PARAM_VARIADIC('+', args, num_args) + ZEND_PARSE_PARAMETERS_END(); #ifdef HAVE_SETLOCALE idx = 0; @@ -4501,9 +4543,11 @@ PHP_FUNCTION(parse_str) char *res = NULL; size_t arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/", &arg, &arglen, &arrayArg) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(arg, arglen) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_DEREF_EX(arrayArg, 0, 1) + ZEND_PARSE_PARAMETERS_END(); res = estrndup(arg, arglen); @@ -4910,10 +4954,13 @@ PHP_FUNCTION(str_getcsv) char *delim_str = NULL, *enc_str = NULL, *esc_str = NULL; size_t delim_len = 0, enc_len = 0, esc_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|sss", &str, &delim_str, &delim_len, - &enc_str, &enc_len, &esc_str, &esc_len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(str) + Z_PARAM_OPTIONAL + Z_PARAM_STRING(delim_str, delim_len) + Z_PARAM_STRING(enc_str, enc_len) + Z_PARAM_STRING(esc_str, esc_len) + ZEND_PARSE_PARAMETERS_END(); delim = delim_len ? delim_str[0] : delim; enc = enc_len ? enc_str[0] : enc; @@ -4932,9 +4979,10 @@ PHP_FUNCTION(str_repeat) zend_string *result; /* Resulting string */ size_t result_len; /* Length of the resulting string */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl", &input_str, &mult) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(input_str) + Z_PARMA_LONG(mult) + ZEND_PARSE_PARAMETERS_END(); if (mult < 0) { php_error_docref(NULL, E_WARNING, "Second argument has to be greater than or equal to 0"); @@ -4987,9 +5035,11 @@ PHP_FUNCTION(count_chars) size_t retlen=0; size_t tmp = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &input, &mymode) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(input) + Z_PARAM_OPTIONAL + Z_PARMA_LONG(mymode) + ZEND_PARSE_PARAMETERS_END(); if (mymode < 0 || mymode > 4) { php_error_docref(NULL, E_WARNING, "Unknown mode"); @@ -5049,9 +5099,10 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case) { zend_string *s1, *s2; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &s1, &s2) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(s1) + Z_PARAM_STR(s2) + ZEND_PARSE_PARAMETERS_END(); RETURN_LONG(strnatcmp_ex(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2), @@ -5194,9 +5245,13 @@ PHP_FUNCTION(substr_count) size_t haystack_len, needle_len; char *p, *endp, cmp; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ll", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STRING(haystack, haystack_len) + Z_PARAM_STRING(needle, needle_len) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(offset) + Z_PARAM_LONG(length) + ZEND_PARSE_PARAMETERS_END(); if (needle_len == 0) { php_error_docref(NULL, E_WARNING, "Empty substring"); @@ -5261,9 +5316,13 @@ PHP_FUNCTION(str_pad) size_t i, left_pad=0, right_pad=0; zend_string *result = NULL; /* Resulting string */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|sl", &input, &pad_length, &pad_str, &pad_str_len, &pad_type_val) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(input) + Z_PARAM_LONG(pad_length) + Z_PARAM_OPTIONAL + Z_PARAM_STRING(pad_str, pad_str_len) + Z_PARAM_LONG(pad_type_val) + ZEND_PARSE_PARAMETERS_END(); /* If resulting string turns out to be shorter than input string, we simply copy the input and return. */ @@ -5335,10 +5394,11 @@ PHP_FUNCTION(sscanf) size_t str_len, format_len; int result, num_args = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss*", &str, &str_len, &format, &format_len, - &args, &num_args) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, -1) + Z_PARAM_STRING(str, str_len) + Z_PARAM_STRING(format, format_len) + Z_PARAM_VARIADIC('*', args, num_args) + ZEND_PARSE_PARAMETERS_END(); result = php_sscanf_internal(str, format, num_args, args, 0, return_value); @@ -5357,9 +5417,9 @@ PHP_FUNCTION(str_rot13) { zend_string *arg; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(arg) + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(arg) == 0) { RETURN_EMPTY_STRING(); @@ -5401,9 +5461,9 @@ PHP_FUNCTION(str_shuffle) { zend_string *arg; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(arg) + ZEND_PARSE_PARAMETERS_END(); RETVAL_STRINGL(ZSTR_VAL(arg), ZSTR_LEN(arg)); if (Z_STRLEN_P(return_value) > 1) { @@ -5430,9 +5490,12 @@ PHP_FUNCTION(str_word_count) size_t char_list_len = 0, word_count = 0; zend_long type = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls", &str, &type, &char_list, &char_list_len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(str) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) + Z_PARAM_STRING(char_list, char_list_len) + ZEND_PARSE_PARAMETERS_END(); switch(type) { case 1: @@ -5510,9 +5573,10 @@ PHP_FUNCTION(money_format) zend_string *str; ssize_t res_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sd", &format, &format_len, &value) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STRING(format, format_len) + Z_PARAM_DOUBLE(value) + ZEND_PARSE_PARAMETERS_END(); p = format; e = p + format_len; @@ -5550,9 +5614,11 @@ PHP_FUNCTION(str_split) char *p; size_t n_reg_segments; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &str, &split_length) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(str) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(split_length) + ZEND_PARSE_PARAMETERS_END(); if (split_length <= 0) { php_error_docref(NULL, E_WARNING, "The length of each segment must be greater than zero"); @@ -5589,9 +5655,10 @@ PHP_FUNCTION(strpbrk) zend_string *haystack, *char_list; char *haystack_ptr, *cl_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &haystack, &char_list) == FAILURE) { - RETURN_FALSE; - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(haystack) + Z_PARAM_STR(char_list) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); if (!ZSTR_LEN(char_list)) { php_error_docref(NULL, E_WARNING, "The character list cannot be empty"); @@ -5620,9 +5687,14 @@ PHP_FUNCTION(substr_compare) zend_bool cs=0; size_t cmp_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl|l!b", &s1, &s2, &offset, &len, &len_is_default, &cs) == FAILURE) { - RETURN_FALSE; - } + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_STR(s1) + Z_PARAM_STR(s2) + Z_PARAM_LONG(offset) + Z_PARAM_OPTIONAL + Z_PARAM_LONG_EX(len, len_is_default, 1, 0) + Z_PARAM_BOOL(cs) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); if (!len_is_default && len <= 0) { if (len == 0) { @@ -5722,9 +5794,9 @@ PHP_FUNCTION(utf8_encode) char *arg; size_t arg_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STRING(arg, arg_len) + ZEND_PARSE_PARAMETERS_END(); RETURN_STR(php_utf8_encode(arg, arg_len)); } @@ -5737,9 +5809,9 @@ PHP_FUNCTION(utf8_decode) char *arg; size_t arg_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STRING(arg, arg_len) + ZEND_PARSE_PARAMETERS_END(); RETURN_STR(php_utf8_decode(arg, arg_len)); }