mirror of
https://github.com/php/php-src.git
synced 2024-09-27 12:57:26 +00:00
- MFB: Fixed bug #45220 (curl_read callback returns -1 when needs to return size_t (unsigned))
This commit is contained in:
parent
059e4f06ef
commit
8514a96c99
@ -785,7 +785,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:
|
||||
@ -832,7 +832,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));
|
||||
|
Loading…
Reference in New Issue
Block a user