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));
{
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");
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);
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
{
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)));
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();
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));
}
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);
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);
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));
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)) {
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);
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) {
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));
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");
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);
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);
{
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();
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);
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);
{
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();
{
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));
{
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));
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;
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) {
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;
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);
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;
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");
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");
{
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),
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");
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. */
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);
{
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();
{
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) {
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:
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;
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");
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");
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) {
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));
}
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));
}