summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/config.m42
-rw-r--r--ext/curl/curl_file.c48
-rw-r--r--ext/curl/interface.c131
-rw-r--r--ext/curl/multi.c69
-rw-r--r--ext/curl/share.c26
-rw-r--r--ext/curl/tests/check_win_config.phpt106
-rw-r--r--ext/curl/tests/curl_basic_009.phpt2
-rw-r--r--ext/curl/tests/curl_basic_010.phpt2
-rw-r--r--ext/curl/tests/curl_basic_016.phpt2
-rw-r--r--ext/curl/tests/curl_basic_018.phpt2
-rw-r--r--ext/curl/tests/curl_basic_021.phpt2
-rw-r--r--ext/curl/tests/curl_multi_getcontent_error3.phpt2
-rw-r--r--ext/curl/tests/curl_setopt_error.phpt2
-rw-r--r--ext/curl/tests/curl_version_error.phpt56
-rw-r--r--ext/curl/tests/curl_version_variation1.phpt318
15 files changed, 396 insertions, 374 deletions
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
index 2f82c3485d..cd32f92ec2 100644
--- a/ext/curl/config.m4
+++ b/ext/curl/config.m4
@@ -61,6 +61,7 @@ if test "$PHP_CURL" != "no"; then
AC_PROG_CPP
AC_MSG_CHECKING([for openssl support in libcurl])
AC_TRY_RUN([
+#include <strings.h>
#include <curl/curl.h>
int main(int argc, char *argv[])
@@ -88,6 +89,7 @@ int main(int argc, char *argv[])
AC_MSG_CHECKING([for gnutls support in libcurl])
AC_TRY_RUN([
+#include <strings.h>
#include <curl/curl.h>
int main(int argc, char *argv[])
diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c
index 7a047feb7f..92378a6c6d 100644
--- a/ext/curl/curl_file.c
+++ b/ext/curl/curl_file.c
@@ -31,24 +31,24 @@ PHP_CURL_API zend_class_entry *curl_CURLFile_class;
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(), "p|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1,3)
+ Z_PARAM_PATH_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));
}
}
@@ -70,34 +70,34 @@ PHP_FUNCTION(curl_file_create)
}
/* }}} */
-static void curlfile_get_property(char *name, INTERNAL_FUNCTION_PARAMETERS)
+static void curlfile_get_property(char *name, size_t name_len, INTERNAL_FUNCTION_PARAMETERS)
{
zval *res, rv;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- res = zend_read_property(curl_CURLFile_class, getThis(), name, strlen(name), 1, &rv);
+ res = zend_read_property(curl_CURLFile_class, getThis(), name, name_len, 1, &rv);
ZVAL_DEREF(res);
ZVAL_COPY(return_value, res);
}
-static void curlfile_set_property(char *name, INTERNAL_FUNCTION_PARAMETERS)
+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, strlen(name), 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()
Get file name */
ZEND_METHOD(CURLFile, getFilename)
{
- curlfile_get_property("name", INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ curlfile_get_property("name", sizeof("name")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
@@ -105,7 +105,7 @@ ZEND_METHOD(CURLFile, getFilename)
Get MIME type */
ZEND_METHOD(CURLFile, getMimeType)
{
- curlfile_get_property("mime", INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ curlfile_get_property("mime", sizeof("mime")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
@@ -113,7 +113,7 @@ ZEND_METHOD(CURLFile, getMimeType)
Get file name for POST */
ZEND_METHOD(CURLFile, getPostFilename)
{
- curlfile_get_property("postname", INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ curlfile_get_property("postname", sizeof("postname")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
@@ -121,7 +121,7 @@ ZEND_METHOD(CURLFile, getPostFilename)
Set MIME type */
ZEND_METHOD(CURLFile, setMimeType)
{
- curlfile_set_property("mime", INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ curlfile_set_property("mime", sizeof("mime")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
@@ -129,7 +129,7 @@ ZEND_METHOD(CURLFile, setMimeType)
Set file name for POST */
ZEND_METHOD(CURLFile, setPostFilename)
{
- curlfile_set_property("postname", INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ curlfile_set_property("postname", sizeof("postname")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index c88bbaef93..21f1f71455 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1822,9 +1822,10 @@ PHP_FUNCTION(curl_version)
curl_version_info_data *d;
zend_long uversion = CURLVERSION_NOW;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &uversion) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(uversion)
+ ZEND_PARSE_PARAMETERS_END();
d = curl_version_info(uversion);
if (d == NULL) {
@@ -1963,12 +1964,12 @@ PHP_FUNCTION(curl_init)
{
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) {
@@ -1987,7 +1988,7 @@ PHP_FUNCTION(curl_init)
_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;
}
@@ -2079,9 +2080,9 @@ PHP_FUNCTION(curl_copy_handle)
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;
@@ -2941,9 +2942,11 @@ PHP_FUNCTION(curl_setopt)
zend_long options;
php_curl *ch;
- 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(zvalue)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
@@ -2971,9 +2974,10 @@ PHP_FUNCTION(curl_setopt_array)
zend_ulong option;
zend_string *string_key;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &zid, &arr) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(zid)
+ Z_PARAM_ARRAY(arr)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
@@ -3017,9 +3021,9 @@ PHP_FUNCTION(curl_exec)
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;
@@ -3074,9 +3078,11 @@ PHP_FUNCTION(curl_getinfo)
php_curl *ch;
zend_long option = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zid, &option) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(zid)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(option)
+ ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
@@ -3285,9 +3291,9 @@ PHP_FUNCTION(curl_error)
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;
@@ -3305,9 +3311,9 @@ PHP_FUNCTION(curl_errno)
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;
@@ -3324,9 +3330,9 @@ PHP_FUNCTION(curl_close)
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;
@@ -3433,9 +3439,9 @@ PHP_FUNCTION(curl_strerror)
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_easy_strerror(code);
if (str) {
@@ -3503,9 +3509,9 @@ PHP_FUNCTION(curl_reset)
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;
@@ -3528,24 +3534,25 @@ PHP_FUNCTION(curl_reset)
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 {
@@ -3558,25 +3565,26 @@ PHP_FUNCTION(curl_escape)
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 {
@@ -3595,9 +3603,10 @@ PHP_FUNCTION(curl_pause)
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;
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 488cfde224..1bb95a2a61 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -82,9 +82,10 @@ PHP_FUNCTION(curl_multi_add_handle)
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;
@@ -169,9 +170,10 @@ PHP_FUNCTION(curl_multi_remove_handle)
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;
@@ -214,9 +216,11 @@ PHP_FUNCTION(curl_multi_select)
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;
@@ -248,9 +252,10 @@ PHP_FUNCTION(curl_multi_exec)
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;
@@ -289,9 +294,9 @@ PHP_FUNCTION(curl_multi_getcontent)
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;
@@ -319,9 +324,11 @@ PHP_FUNCTION(curl_multi_info_read)
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;
@@ -369,9 +376,9 @@ PHP_FUNCTION(curl_multi_close)
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;
@@ -420,9 +427,9 @@ PHP_FUNCTION(curl_multi_errno)
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;
@@ -440,9 +447,9 @@ PHP_FUNCTION(curl_multi_strerror)
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) {
@@ -598,9 +605,11 @@ PHP_FUNCTION(curl_multi_setopt)
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;
diff --git a/ext/curl/share.c b/ext/curl/share.c
index 04bc4f22f7..4bbeff70db 100644
--- a/ext/curl/share.c
+++ b/ext/curl/share.c
@@ -59,9 +59,9 @@ PHP_FUNCTION(curl_share_close)
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;
@@ -104,9 +104,11 @@ PHP_FUNCTION(curl_share_setopt)
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;
@@ -138,9 +140,9 @@ PHP_FUNCTION(curl_share_errno)
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;
@@ -159,9 +161,9 @@ PHP_FUNCTION(curl_share_strerror)
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) {
diff --git a/ext/curl/tests/check_win_config.phpt b/ext/curl/tests/check_win_config.phpt
index fc1c66609a..2c7c399009 100644
--- a/ext/curl/tests/check_win_config.phpt
+++ b/ext/curl/tests/check_win_config.phpt
@@ -1,53 +1,53 @@
---TEST--
-Check libcurl config on windows
---SKIPIF--
-<?php
-if (!extension_loaded("curl")) {
- die('skip - curl extension not available in this build');
-}
-if(substr(PHP_OS, 0, 3) != 'WIN' )
- die("skip for windows only");
-?>
---FILE--
-<?php
- ob_start();
- phpinfo();
- $s = ob_get_contents();
- ob_end_clean();
- preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
-
- echo $m[1], "\n";
-
-?>
-DONE
---EXPECTF--
-cURL support => enabled
-cURL Information => %s
-Age => %d
-Features
-AsynchDNS => Yes
-CharConv => No
-Debug => No
-GSS-Negotiate => No
-IDN => Yes
-IPv6 => Yes
-krb4 => No
-Largefile => Yes
-libz => Yes
-NTLM => Yes
-NTLMWB => No
-SPNEGO => Yes
-SSL => Yes
-SSPI => Yes
-TLS-SRP => No
-HTTP2 => No
-GSSAPI => No
-KERBEROS5 => Yes
-UNIX_SOCKETS => No
-PSL => No
-Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
-Host => %s-pc-win32
-SSL Version => OpenSSL/%s
-ZLib Version => %s
-libSSH Version => libssh2/%s
-DONE
+--TEST--
+Check libcurl config on windows
+--SKIPIF--
+<?php
+if (!extension_loaded("curl")) {
+ die('skip - curl extension not available in this build');
+}
+if(substr(PHP_OS, 0, 3) != 'WIN' )
+ die("skip for windows only");
+?>
+--FILE--
+<?php
+ ob_start();
+ phpinfo();
+ $s = ob_get_contents();
+ ob_end_clean();
+ preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
+
+ echo $m[1], "\n";
+
+?>
+DONE
+--EXPECTF--
+cURL support => enabled
+cURL Information => %s
+Age => %d
+Features
+AsynchDNS => Yes
+CharConv => No
+Debug => No
+GSS-Negotiate => No
+IDN => Yes
+IPv6 => Yes
+krb4 => No
+Largefile => Yes
+libz => Yes
+NTLM => Yes
+NTLMWB => No
+SPNEGO => Yes
+SSL => Yes
+SSPI => Yes
+TLS-SRP => No
+HTTP2 => No
+GSSAPI => No
+KERBEROS5 => Yes
+UNIX_SOCKETS => No
+PSL => No
+Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
+Host => %s-pc-win32
+SSL Version => OpenSSL/%s
+ZLib Version => %s
+libSSH Version => libssh2/%s
+DONE
diff --git a/ext/curl/tests/curl_basic_009.phpt b/ext/curl/tests/curl_basic_009.phpt
index 529e590090..99e94cd9b2 100644
--- a/ext/curl/tests/curl_basic_009.phpt
+++ b/ext/curl/tests/curl_basic_009.phpt
@@ -19,5 +19,5 @@ curl_close($ch);
?>
--EXPECTF--
-%unicode|string%(%d) "%Srotocol%s"
+string(%d) "%Srotocol%s"
int(1)
diff --git a/ext/curl/tests/curl_basic_010.phpt b/ext/curl/tests/curl_basic_010.phpt
index 72a591ff16..20bcc59be6 100644
--- a/ext/curl/tests/curl_basic_010.phpt
+++ b/ext/curl/tests/curl_basic_010.phpt
@@ -26,5 +26,5 @@ curl_close($ch);
?>
--EXPECTF--
-%unicode|string%(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:|Could not resolve:)%r %s"
+string(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:|Could not resolve:)%r %s"
int(5)
diff --git a/ext/curl/tests/curl_basic_016.phpt b/ext/curl/tests/curl_basic_016.phpt
index b5890c0f6e..2bd1f05037 100644
--- a/ext/curl/tests/curl_basic_016.phpt
+++ b/ext/curl/tests/curl_basic_016.phpt
@@ -19,7 +19,7 @@ if ($curl_version['version_number'] > 0x071201) {
===DONE===
--EXPECTF--
array(2%d) {
- [%u|b%"url"]=>
+ ["url"]=>
string(0) ""
["content_type"]=>
NULL
diff --git a/ext/curl/tests/curl_basic_018.phpt b/ext/curl/tests/curl_basic_018.phpt
index 359421fc0a..5c085c1c93 100644
--- a/ext/curl/tests/curl_basic_018.phpt
+++ b/ext/curl/tests/curl_basic_018.phpt
@@ -66,7 +66,7 @@ TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
===DONE===
--EXPECTF--
*** Testing curl_exec() : basic functionality ***
-%unicode|string%(75) "Hello World!
+string(75) "Hello World!
Hello World!Hello World!
Hello World!Hello World!
Hello World!"
diff --git a/ext/curl/tests/curl_basic_021.phpt b/ext/curl/tests/curl_basic_021.phpt
index d9f5a90bef..e803d98837 100644
--- a/ext/curl/tests/curl_basic_021.phpt
+++ b/ext/curl/tests/curl_basic_021.phpt
@@ -18,5 +18,5 @@ Jean-Marc Fontaine <jmf@durcommefaire.net>
?>
===DONE===
--EXPECTF--
-%unicode|string%(24) "text/plain;charset=utf-8"
+string(24) "text/plain;charset=utf-8"
===DONE===
diff --git a/ext/curl/tests/curl_multi_getcontent_error3.phpt b/ext/curl/tests/curl_multi_getcontent_error3.phpt
index 2ad14804ba..2e1c7b2765 100644
--- a/ext/curl/tests/curl_multi_getcontent_error3.phpt
+++ b/ext/curl/tests/curl_multi_getcontent_error3.phpt
@@ -49,5 +49,5 @@ if (!extension_loaded('curl')) print 'skip';
?>
--EXPECTF--
-Warning: curl_multi_getcontent() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
+Warning: curl_multi_getcontent() expects parameter 1 to be resource, string given in %s on line %d
CURL2
diff --git a/ext/curl/tests/curl_setopt_error.phpt b/ext/curl/tests/curl_setopt_error.phpt
index dd7298342e..b9727c8a55 100644
--- a/ext/curl/tests/curl_setopt_error.phpt
+++ b/ext/curl/tests/curl_setopt_error.phpt
@@ -40,6 +40,6 @@ Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
Warning: curl_setopt() expects parameter 1 to be resource, boolean given in %s on line %d
-Warning: curl_setopt() expects parameter 2 to be integer, %unicode_string_optional% given in %s on line %d
+Warning: curl_setopt() expects parameter 2 to be integer, string given in %s on line %d
Warning: curl_setopt(): Invalid curl configuration option in %scurl_setopt_error.php on line %d
diff --git a/ext/curl/tests/curl_version_error.phpt b/ext/curl/tests/curl_version_error.phpt
index a9b80c55be..39f99a0fad 100644
--- a/ext/curl/tests/curl_version_error.phpt
+++ b/ext/curl/tests/curl_version_error.phpt
@@ -1,28 +1,28 @@
---TEST--
-Test curl_version() function : error conditions
---SKIPIF--
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
---FILE--
-<?php
-
-/* Prototype : array curl_version ([ int $age ] )
- * Description: Returns information about the cURL version.
- * Source code: ext/curl/interface.c
-*/
-
-echo "*** Testing curl_version() : error conditions ***\n";
-
-echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( curl_version(1, $extra_arg) );
-
-?>
-===Done===
---EXPECTF--
-*** Testing curl_version() : error conditions ***
-
--- Testing curl_version() function with more than expected no. of arguments --
-
-Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-===Done===
+--TEST--
+Test curl_version() function : error conditions
+--SKIPIF--
+<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
+--FILE--
+<?php
+
+/* Prototype : array curl_version ([ int $age ] )
+ * Description: Returns information about the cURL version.
+ * Source code: ext/curl/interface.c
+*/
+
+echo "*** Testing curl_version() : error conditions ***\n";
+
+echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( curl_version(1, $extra_arg) );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing curl_version() : error conditions ***
+
+-- Testing curl_version() function with more than expected no. of arguments --
+
+Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+===Done===
diff --git a/ext/curl/tests/curl_version_variation1.phpt b/ext/curl/tests/curl_version_variation1.phpt
index 65f5e69acb..7c0106cb6a 100644
--- a/ext/curl/tests/curl_version_variation1.phpt
+++ b/ext/curl/tests/curl_version_variation1.phpt
@@ -1,159 +1,159 @@
---TEST--
-Test curl_version() function : usage variations - test values for $ascii argument
---SKIPIF--
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
-if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
---FILE--
-<?php
-
-/* Prototype : array curl_version ([ int $age ] )
- * Description: Returns information about the cURL version.
- * Source code: ext/curl/interface.c
-*/
-
-echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
-
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-//defining a class
-class sample {
- public function __toString() {
- return "sample object";
- }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
-// array with different values for $input
-$inputs = array (
-
- // integer values
- 0,
- 1,
- 255,
- 256,
- PHP_INT_MAX,
- -PHP_INT_MAX,
-
- // float values
- 10.5,
- -20.5,
- 10.1234567e10,
-
- // array values
- array(),
- array(0),
- array(1, 2),
-
- //string values
- "ABC",
- 'abc',
- "2abc",
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // null values
- NULL,
- null,
-
- // objects
- new sample(),
-
- // resource
- $file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
-);
-
-// loop through with each element of the $inputs array to test curl_version() function
-$count = 1;
-foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump( is_array(curl_version($input)) );
- $count ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-?>
-===Done===
---EXPECTF--
-*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
--- Iteration 1 --
-bool(true)
--- Iteration 2 --
-bool(true)
--- Iteration 3 --
-bool(true)
--- Iteration 4 --
-bool(true)
--- Iteration 5 --
-bool(true)
--- Iteration 6 --
-bool(true)
--- Iteration 7 --
-bool(true)
--- Iteration 8 --
-bool(true)
--- Iteration 9 --
-bool(true)
--- Iteration 10 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 11 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 12 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 13 --
-
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
-bool(false)
--- Iteration 14 --
-
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
-bool(false)
--- Iteration 15 --
-
-Notice: A non well formed numeric value encountered in %s on line %d
-bool(true)
--- Iteration 16 --
-bool(true)
--- Iteration 17 --
-bool(true)
--- Iteration 18 --
-bool(true)
--- Iteration 19 --
-bool(true)
--- Iteration 20 --
-bool(true)
--- Iteration 21 --
-bool(true)
--- Iteration 22 --
-
-Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
-bool(false)
--- Iteration 23 --
-
-Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
-bool(false)
--- Iteration 24 --
-bool(true)
--- Iteration 25 --
-bool(true)
-===Done===
+--TEST--
+Test curl_version() function : usage variations - test values for $ascii argument
+--SKIPIF--
+<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
+--FILE--
+<?php
+
+/* Prototype : array curl_version ([ int $age ] )
+ * Description: Returns information about the cURL version.
+ * Source code: ext/curl/interface.c
+*/
+
+echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+ 0,
+ 1,
+ 255,
+ 256,
+ PHP_INT_MAX,
+ -PHP_INT_MAX,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ //string values
+ "ABC",
+ 'abc',
+ "2abc",
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test curl_version() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( is_array(curl_version($input)) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===Done===
+--EXPECTF--
+*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+
+Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+
+Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
+bool(false)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+===Done===