diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2008-02-07 02:08:45 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2008-02-07 02:08:45 +0000 |
| commit | 87eb2a9ec3d4c7fedd41358ca452bde463b106a3 (patch) | |
| tree | dfcd769194169b489ea6cb6f0225c143abb216f1 /ext/curl | |
| parent | b7b41a6612f728d88c9fbc572ba02d595cc7479c (diff) | |
| download | php-git-87eb2a9ec3d4c7fedd41358ca452bde463b106a3.tar.gz | |
New param parsing API
Diffstat (limited to 'ext/curl')
| -rw-r--r-- | ext/curl/interface.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 473839eada..43c3c7b703 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1085,18 +1085,17 @@ static void alloc_curl_handle(php_curl **ch) Initialize a cURL session */ PHP_FUNCTION(curl_init) { - zval **url; php_curl *ch; CURL *cp; - int argc = ZEND_NUM_ARGS(); + char *url = NULL; + int url_len; - if (argc < 0 || argc > 1 || zend_get_parameters_ex(argc, &url) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &url, &url_len) == FAILURE) { + return; } - if (argc > 0) { - convert_to_string_ex(url); - PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(url), Z_STRLEN_PP(url), (void) NULL); + if (url) { + PHP_CURL_CHECK_OPEN_BASEDIR(url, url_len, (void) NULL); } cp = curl_easy_init(); @@ -1133,10 +1132,10 @@ PHP_FUNCTION(curl_init) curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1); #endif - if (argc > 0) { + if (url) { char *urlcopy; - urlcopy = estrndup(Z_STRVAL_PP(url), Z_STRLEN_PP(url)); + urlcopy = estrndup(url, url_len); curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy); zend_llist_add_element(&ch->to_free.str, &urlcopy); } |
