Fix #79033: Curl timeout error with specific url and post

We must not set an empty mime structure as `CURLOPT_MIMEPOST`; instead
we set it to `NULL` if `CURLOPT_POSTFIELDS` has been set to an empty
array.
This commit is contained in:
Christoph M. Becker 2019-12-28 10:47:03 +01:00
parent 27bb3289ac
commit c47b18a222
3 changed files with 36 additions and 4 deletions

View file

@ -2804,7 +2804,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
zend_string *string_key;
zend_ulong num_key;
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
curl_mime *mime;
curl_mime *mime = NULL;
curl_mimepart *part;
CURLcode form_error;
#else
@ -2819,9 +2819,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
mime = curl_mime_init(ch->cp);
if (mime == NULL) {
return FAILURE;
if (zend_hash_num_elements(postfields) > 0) {
mime = curl_mime_init(ch->cp);
if (mime == NULL) {
return FAILURE;
}
}
#endif