From: Felipe Pena Date: Sat, 12 Jul 2008 21:11:56 +0000 (+0000) Subject: - Fixed bug #45220 (curl_read callback returns -1 when needs to return size_t (unsigned)) X-Git-Tag: php-5.2.7RC1~213 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a0f24f8bf12afdcdc6fb8aca84c398419d46f81;p=php - Fixed bug #45220 (curl_read callback returns -1 when needs to return size_t (unsigned)) --- diff --git a/ext/curl/interface.c b/ext/curl/interface.c index f832d5bbd5..e5e5d122ec 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -786,7 +786,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) { php_curl *ch = (php_curl *) ctx; php_curl_read *t = ch->handlers->read; - int length = -1; + int length = 0; switch (t->method) { case PHP_CURL_DIRECT: @@ -833,7 +833,9 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) ch->in_callback = 0; if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); - length = -1; +#if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */ + length = CURL_READFUNC_ABORT; +#endif } else if (retval_ptr) { if (Z_TYPE_P(retval_ptr) == IS_STRING) { length = MIN(size * nmemb, Z_STRLEN_P(retval_ptr));