diff options
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r-- | ext/curl/interface.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 01742ba3e5..7faf439ce1 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2969,7 +2969,14 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ case CURLOPT_POSTFIELDS: if (Z_TYPE_P(zvalue) == IS_ARRAY || Z_TYPE_P(zvalue) == IS_OBJECT) { - return build_mime_structure_from_hash(ch, zvalue); + if (zend_hash_num_elements(HASH_OF(zvalue)) == 0) { + /* no need to build the mime structure for empty hashtables; + also works around https://github.com/curl/curl/issues/6455 */ + curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, ""); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0); + } else { + return build_mime_structure_from_hash(ch, zvalue); + } } else { #if LIBCURL_VERSION_NUM >= 0x071101 zend_string *tmp_str; |