static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
- char *fname = NULL, *mime = NULL, *postname = NULL;
- size_t fname_len, mime_len, postname_len;
+ zend_string *fname, *mime = NULL, *postname = NULL;
zval *cf = return_value;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,3)
+ Z_PARAM_STR(fname)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR(mime)
+ Z_PARAM_STR(postname)
+ ZEND_PARSE_PARAMETERS_END();
- if (fname) {
- zend_update_property_string(curl_CURLFile_class, cf, "name", sizeof("name")-1, fname);
- }
+ zend_update_property_string(curl_CURLFile_class, cf, "name", sizeof("name")-1, ZSTR_VAL(fname));
if (mime) {
- zend_update_property_string(curl_CURLFile_class, cf, "mime", sizeof("mime")-1, mime);
+ zend_update_property_string(curl_CURLFile_class, cf, "mime", sizeof("mime")-1, ZSTR_VAL(mime));
}
if (postname) {
- zend_update_property_string(curl_CURLFile_class, cf, "postname", sizeof("postname")-1, postname);
+ zend_update_property_string(curl_CURLFile_class, cf, "postname", sizeof("postname")-1, ZSTR_VAL(postname));
}
}
static void curlfile_set_property(char *name, size_t name_len, INTERNAL_FUNCTION_PARAMETERS)
{
- char *arg = NULL;
- size_t arg_len;
+ zend_string *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
- return;
- }
- zend_update_property_string(curl_CURLFile_class, getThis(), name, name_len, arg);
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_STR(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
+ zend_update_property_string(curl_CURLFile_class, getThis(), name, name_len, ZSTR_VAL(arg));
}
/* {{{ proto string CURLFile::getFilename()
{
php_curl *ch;
CURL *cp;
- char *url = NULL;
- size_t url_len = 0;
+ zend_string *url = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &url, &url_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0,1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR(url)
+ ZEND_PARSE_PARAMETERS_END();
cp = curl_easy_init();
if (!cp) {
_php_curl_set_default_options(ch);
if (url) {
- if (php_curl_option_url(ch, url, url_len) == FAILURE) {
+ if (php_curl_option_url(ch, ZSTR_VAL(url), ZSTR_LEN(url)) == FAILURE) {
_php_curl_close_ex(ch);
RETURN_FALSE;
}
zval *zid;
php_curl *ch, *dupch;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zid) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(zid)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
zval *zid;
php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zid) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(zid)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
URL encodes the given string */
PHP_FUNCTION(curl_escape)
{
- char *str = NULL, *res = NULL;
- size_t str_len = 0;
- zval *zid;
- php_curl *ch;
+ zend_string *str;
+ char *res;
+ zval *zid;
+ php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &zid, &str, &str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2,2)
+ Z_PARAM_RESOURCE(zid)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
}
- if (ZEND_SIZE_T_INT_OVFL(str_len)) {
+ if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(str))) {
RETURN_FALSE;
}
- if ((res = curl_easy_escape(ch->cp, str, str_len))) {
+ if ((res = curl_easy_escape(ch->cp, ZSTR_VAL(str), ZSTR_LEN(str)))) {
RETVAL_STRING(res);
curl_free(res);
} else {
URL decodes the given string */
PHP_FUNCTION(curl_unescape)
{
- char *str = NULL, *out = NULL;
- size_t str_len = 0;
- int out_len;
- zval *zid;
- php_curl *ch;
+ char *out = NULL;
+ int out_len;
+ zval *zid;
+ zend_string *str;
+ php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &zid, &str, &str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2,2)
+ Z_PARAM_RESOURCE(zid)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
}
- if (ZEND_SIZE_T_INT_OVFL(str_len)) {
+ if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(str))) {
RETURN_FALSE;
}
- if ((out = curl_easy_unescape(ch->cp, str, str_len, &out_len))) {
+ if ((out = curl_easy_unescape(ch->cp, ZSTR_VAL(str), ZSTR_LEN(str), &out_len))) {
RETVAL_STRINGL(out, out_len);
curl_free(out);
} else {
zval *zid;
php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zid, &bitmask) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2,2)
+ Z_PARAM_RESOURCE(zid)
+ Z_PARAM_LONG(bitmask)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
zval tmp_val;
CURLMcode error = CURLM_OK;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &z_mh, &z_ch) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2,2)
+ Z_PARAM_RESOURCE(z_mh)
+ Z_PARAM_RESOURCE(z_ch)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
php_curl *ch;
CURLMcode error = CURLM_OK;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &z_mh, &z_ch) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2,2)
+ Z_PARAM_RESOURCE(z_mh)
+ Z_PARAM_RESOURCE(z_ch)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
struct timeval to;
CURLMcode error = CURLM_OK;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|d", &z_mh, &timeout) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,2)
+ Z_PARAM_RESOURCE(z_mh)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_DOUBLE(timeout)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
int still_running;
CURLMcode error = CURLM_OK;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/", &z_mh, &z_still_running) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_mh)
+ Z_PARAM_ZVAL_DEREF_EX(z_still_running, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
zval *z_ch;
php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_ch) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(z_ch)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
int queued_msgs;
zval *zmsgs_in_queue = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z/", &z_mh, &zmsgs_in_queue) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(z_mh)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF_EX(zmsgs_in_queue, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
zval *z_mh;
php_curlm *mh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_mh) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(z_mh)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
zval *z_mh;
php_curlm *mh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_mh) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(z_mh)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
zend_long code;
const char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &code) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_LONG(code)
+ ZEND_PARSE_PARAMETERS_END();
str = curl_multi_strerror(code);
if (str) {
zend_long options;
php_curlm *mh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &z_mh, &options, &zvalue) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3,3)
+ Z_PARAM_RESOURCE(z_mh)
+ Z_PARAM_LONG(options)
+ Z_PARAM_ZVAL_DEREF(zvalue)
+ ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
RETURN_FALSE;
zval *z_sh;
php_curlsh *sh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_sh) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(z_sh)
+ ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
RETURN_FALSE;
zend_long options;
php_curlsh *sh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &zid, &options, &zvalue) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3,3)
+ Z_PARAM_RESOURCE(zid)
+ Z_PARAM_LONG(options)
+ Z_PARAM_ZVAL_DEREF(zvalue)
+ ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(zid), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
RETURN_FALSE;
zval *z_sh;
php_curlsh *sh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_sh) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_RESOURCE(z_sh)
+ ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
RETURN_FALSE;
zend_long code;
const char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &code) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,1)
+ Z_PARAM_LONG(code)
+ ZEND_PARSE_PARAMETERS_END();
str = curl_share_strerror(code);
if (str) {