iliaa Thu Feb 7 02:08:45 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/curl interface.c Log: New param parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.27.2.8&r2=1.62.2.14.2.27.2.9&diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.62.2.14.2.27.2.8 php-src/ext/curl/interface.c:1.62.2.14.2.27.2.9 --- php-src/ext/curl/interface.c:1.62.2.14.2.27.2.8 Sun Jan 6 17:12:44 2008 +++ php-src/ext/curl/interface.c Thu Feb 7 02:08:45 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interface.c,v 1.62.2.14.2.27.2.8 2008/01/06 17:12:44 iliaa Exp $ */ +/* $Id: interface.c,v 1.62.2.14.2.27.2.9 2008/02/07 02:08:45 iliaa Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -1085,18 +1085,17 @@ 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 @@ 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); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php