php_stream *stream;
zend_long operation = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z/", &res, &operation, &wouldblock) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_RESOURCE(res)
+ Z_PARAM_LONG(operation)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF_EX(wouldblock, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
memset(&md, 0, sizeof(md));
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &filename, &filename_len, &use_include_path) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ ZEND_PARSE_PARAMETERS_END();
md.stream = php_stream_open_wrapper(filename, "rb",
(use_include_path ? USE_PATH : 0) | REPORT_ERRORS,
zend_string *contents;
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ Z_PARAM_LONG(offset)
+ Z_PARAM_LONG(maxlen)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
php_error_docref(NULL, E_WARNING, "length must be greater than or equal to zero");
php_stream *srcstream = NULL;
char mode[3] = "wb";
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_ZVAL_DEREF_EX(data, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(data) == IS_RESOURCE) {
php_stream_from_zval(srcstream, data);
zend_string *target_buf;
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
+
if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) {
php_error_docref(NULL, E_WARNING, "'" ZEND_LONG_FMT "' flag is not supported", flags);
RETURN_FALSE;
int fd;
zend_string *p;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(dir, dir_len)
+ Z_PARAM_PATH(prefix, prefix_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(dir)) {
RETURN_FALSE;
php_stream *stream;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_STRING(mode, mode_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
php_stream *stream;
char *posix_mode;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &command, &command_len, &mode, &mode_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(command, command_len)
+ Z_PARAM_STRING(mode, mode_len)
+ ZEND_PARSE_PARAMETERS_END();
posix_mode = estrndup(mode, mode_len);
#ifndef PHP_WIN32
zval *res;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(res)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, res);
int result;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(res)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, res);
char *allowed_tags=NULL;
size_t allowed_tags_len=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ls", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_RESOURCE(fd)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(bytes)
+ Z_PARAM_STRING(allowed_tags, allowed_tags_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, fd);
size_t len;
void *what;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_RESOURCE(file_handle)
+ Z_PARAM_STRING(format, format_len)
+ Z_PARAM_VARIADIC('*', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
what = zend_fetch_resource2(Z_RES_P(file_handle), "File-Handle", php_file_le_stream(), php_file_le_pstream());
zend_bool recursive = 0;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_PATH(dir, dir_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mode)
+ Z_PARAM_BOOL(recursive)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &dir, &dir_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(dir, dir_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
php_stream *stream;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
BG(umask) = oldumask;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mask) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mask)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (ZEND_NUM_ARGS() == 0) {
umask(oldumask);
size_t size;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(res)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, res);
php_stream_wrapper *wrapper;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_PATH(old_name, old_name_len)
+ Z_PARAM_PATH(new_name, new_name_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0);
zval *zcontext = NULL;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &filename, &filename_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
zend_long size;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &fp, &size) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(fp)
+ Z_PARAM_LONG(size)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (size < 0) {
php_error_docref(NULL, E_WARNING, "Negative size is not supported");
"size", "atime", "mtime", "ctime", "blksize", "blocks"
};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &fp) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(fp)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, fp);
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_PATH(source, source_len)
+ Z_PARAM_PATH(target, target_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(source)) {
RETURN_FALSE;
char *delimiter_str = NULL, *enclosure_str = NULL, *escape_str = NULL;
size_t delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra|sss",
- &fp, &fields, &delimiter_str, &delimiter_str_len,
- &enclosure_str, &enclosure_str_len,
- &escape_str, &escape_str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 5)
+ Z_PARAM_RESOURCE(fp)
+ Z_PARAM_ARRAY(fields)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(delimiter_str, delimiter_str_len)
+ Z_PARAM_STRING(enclosure_str, enclosure_str_len)
+ Z_PARAM_STRING(escape_str, escape_str_len)
+ ZEND_PARSE_PARAMETERS_END();
if (delimiter_str != NULL) {
/* Make sure that there is at least one character in string */
char *escape_str = NULL;
size_t escape_str_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|zsss",
- &fd, &len_zv, &delimiter_str, &delimiter_str_len,
- &enclosure_str, &enclosure_str_len,
- &escape_str, &escape_str_len) == FAILURE
- ) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_RESOURCE(fd)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(len_zv)
+ Z_PARAM_STRING(delimiter_str, delimiter_str_len)
+ Z_PARAM_STRING(enclosure_str, enclosure_str_len)
+ Z_PARAM_STRING(escape_str, escape_str_len)
+ ZEND_PARSE_PARAMETERS_END();
if (delimiter_str != NULL) {
/* Make sure that there is at least one character in string */
size_t pattern_len, filename_len;
zend_long flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_PATH(pattern, pattern_len)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ ZEND_PARSE_PARAMETERS_END();
if (filename_len >= MAXPATHLEN) {
php_error_docref(NULL, E_WARNING, "Filename exceeds the maximum allowed length of %d characters", MAXPATHLEN);