summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/ftok.c7
-rw-r--r--ext/standard/image.c22
-rw-r--r--ext/standard/md5.c16
-rw-r--r--ext/standard/microtime.c14
-rw-r--r--ext/standard/proc_open.c34
-rw-r--r--ext/standard/sha1.c16
-rw-r--r--ext/standard/url.c17
7 files changed, 76 insertions, 50 deletions
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
index 02cf61daf6..f19f16fe57 100644
--- a/ext/standard/ftok.c
+++ b/ext/standard/ftok.c
@@ -39,9 +39,10 @@ PHP_FUNCTION(ftok)
size_t pathname_len, proj_len;
key_t k;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &pathname, &pathname_len, &proj, &proj_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(pathname, pathname_len)
+ Z_PARAM_STRING(proj, proj_len)
+ ZEND_PARSE_PARAMETERS_END();
if (pathname_len == 0){
php_error_docref(NULL, E_WARNING, "Pathname is invalid");
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 4fb8298f76..61cafe5e80 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -1217,9 +1217,9 @@ PHP_FUNCTION(image_type_to_mime_type)
{
zend_long p_image_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &p_image_type) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(p_image_type)
+ ZEND_PARSE_PARAMETERS_END();
ZVAL_STRING(return_value, (char*)php_image_type_to_mime_type(p_image_type));
}
@@ -1232,9 +1232,11 @@ PHP_FUNCTION(image_type_to_extension)
zend_long image_type;
zend_bool inc_dot=1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|b", &image_type, &inc_dot) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_LONG(image_type)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(inc_dot)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
switch (image_type) {
case IMAGE_FILETYPE_GIF:
@@ -1470,9 +1472,11 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
size_t input_len;
const int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "s|z/", &input, &input_len, &info) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(input, input_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF_EX(info, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (argc == 2) {
zval_dtor(info);
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 825df21c69..cb43e67441 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -52,9 +52,11 @@ PHP_NAMED_FUNCTION(php_if_md5)
PHP_MD5_CTX context;
unsigned char digest[16];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &arg, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(arg)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
md5str[0] = '\0';
PHP_MD5Init(&context);
@@ -84,9 +86,11 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
size_t n;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(arg, arg_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) {
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 9a75038fa8..196d8cf1a6 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -53,9 +53,10 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode)
zend_bool get_as_float = 0;
struct timeval tp = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &get_as_float) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(get_as_float)
+ ZEND_PARSE_PARAMETERS_END();
if (gettimeofday(&tp, NULL)) {
RETURN_FALSE;
@@ -112,9 +113,10 @@ PHP_FUNCTION(getrusage)
zend_long pwho = 0;
int who = RUSAGE_SELF;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &pwho) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(pwho)
+ ZEND_PARSE_PARAMETERS_END();
if (pwho == 1) {
who = RUSAGE_CHILDREN;
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index b8294ed0e9..5675a69028 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -247,9 +247,11 @@ PHP_FUNCTION(proc_terminate)
struct php_process_handle *proc;
zend_long sig_no = SIGTERM;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zproc, &sig_no) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(zproc)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sig_no)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -278,9 +280,9 @@ PHP_FUNCTION(proc_close)
zval *zproc;
struct php_process_handle *proc;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zproc) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zproc)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -308,9 +310,9 @@ PHP_FUNCTION(proc_get_status)
int running = 1, signaled = 0, stopped = 0;
int exitcode = -1, termsig = 0, stopsig = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zproc) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zproc)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -443,11 +445,15 @@ PHP_FUNCTION(proc_open)
php_file_descriptor_t slave_pty = -1;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "saz/|s!a!a!", &command,
- &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment,
- &other_options) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 6)
+ Z_PARAM_STRING(command, command_len)
+ Z_PARAM_ARRAY(descriptorspec)
+ Z_PARAM_ZVAL_DEREF_EX(pipes, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING_EX(cwd, cwd_len, 1, 0)
+ Z_PARAM_ARRAY_EX(environment, 1, 0)
+ Z_PARAM_ARRAY_EX(other_options, 1, 0)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
command = pestrdup(command, is_persistent);
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index c4bed51abc..cb7e3645b7 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -40,9 +40,11 @@ PHP_FUNCTION(sha1)
PHP_SHA1_CTX context;
unsigned char digest[20];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &arg, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(arg)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
sha1str[0] = '\0';
PHP_SHA1Init(&context);
@@ -74,9 +76,11 @@ PHP_FUNCTION(sha1_file)
size_t n;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(arg, arg_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) {
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 915db481ba..e8eb2add76 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -336,9 +336,11 @@ PHP_FUNCTION(parse_url)
php_url *resource;
zend_long key = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &key) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(key)
+ ZEND_PARSE_PARAMETERS_END();
resource = php_url_parse_ex(str, str_len);
if (resource == NULL) {
@@ -655,9 +657,12 @@ PHP_FUNCTION(get_headers)
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr!", &url, &url_len, &format, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STRING(url, url_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(format)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);