diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-28 10:47:03 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-28 10:47:03 +0100 |
commit | c47b18a222ceb1d78810d2822170cbf6e110a98c (patch) | |
tree | 5602e99e79caf706f5b9e8777a896e5758545cd5 /ext/curl/interface.c | |
parent | 27bb3289aceb5225e4dd39f082a48823756a8190 (diff) | |
download | php-git-c47b18a222ceb1d78810d2822170cbf6e110a98c.tar.gz |
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.
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r-- | ext/curl/interface.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 313743b62b..0772b3a522 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -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 |