summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-07-12 21:11:56 +0000
committerFelipe Pena <felipe@php.net>2008-07-12 21:11:56 +0000
commit0a0f24f8bf12afdcdc6fb8aca84c398419d46f81 (patch)
tree2a43aa043904fb5857823578c018c072290bfea6 /ext
parenta256d977ff789cff0239099ae05eb761a0018d33 (diff)
downloadphp-git-0a0f24f8bf12afdcdc6fb8aca84c398419d46f81.tar.gz
- Fixed bug #45220 (curl_read callback returns -1 when needs to return size_t (unsigned))
Diffstat (limited to 'ext')
-rw-r--r--ext/curl/interface.c6
1 files changed, 4 insertions, 2 deletions
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));