summaryrefslogtreecommitdiff
path: root/ext/curl/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r--ext/curl/interface.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index f01f6f775a..82d97053ee 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2722,7 +2722,14 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
case CURLOPT_POSTFIELDS:
if (Z_TYPE_P(zvalue) == IS_ARRAY) {
- 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 {
zend_string *tmp_str;
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);