summaryrefslogtreecommitdiff
path: root/ext/curl/multi.c
diff options
context:
space:
mode:
authorPierrick Charron <pierrick@php.net>2012-12-23 15:45:39 -0500
committerPierrick Charron <pierrick@php.net>2012-12-23 15:45:39 -0500
commit4b4f3db73142799da71be14d73938456e918b3ac (patch)
tree3dd3c56065bd96d67d86276ecb63eaf3fd18ea09 /ext/curl/multi.c
parent64595a5d1a51417ae518e124c61e1a9840d221a8 (diff)
downloadphp-git-4b4f3db73142799da71be14d73938456e918b3ac.tar.gz
Support for curl_strerror and curl_multi_strerror
Add the support for both curl_strerror and curl_multi_strerror. Those function will return a string describing the error code passed in the argument errornum
Diffstat (limited to 'ext/curl/multi.c')
-rw-r--r--ext/curl/multi.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 48655ba6e4..4cf9d5fb4a 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -359,6 +359,28 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
}
/* }}} */
+#if LIBCURL_VERSION_NUM >= 0x070c00 /* Available since 7.12.0 */
+/* {{{ proto bool curl_multi_strerror(int code)
+ return string describing error code */
+PHP_FUNCTION(curl_multi_strerror)
+{
+ long code;
+ const char *str;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) {
+ return;
+ }
+
+ str = curl_multi_strerror(code);
+ if (str) {
+ RETURN_STRING(str, 1);
+ } else {
+ RETURN_NULL();
+ }
+}
+/* }}} */
+#endif
+
#if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */
static int _php_curl_multi_setopt(php_curlm *mh, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
{
@@ -389,7 +411,6 @@ static int _php_curl_multi_setopt(php_curlm *mh, long option, zval **zvalue, zva
}
/* }}} */
-
/* {{{ proto int curl_multi_setopt(resource mh, int option, mixed value)
Set an option for the curl multi handle */
PHP_FUNCTION(curl_multi_setopt)