]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4' into PHP-8.0
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 18 Jan 2021 10:01:01 +0000 (11:01 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 18 Jan 2021 10:01:01 +0000 (11:01 +0100)
* PHP-7.4:
  Fix #80595: Resetting POSTFIELDS to empty array breaks request

1  2 
NEWS
ext/curl/interface.c
ext/curl/tests/bug79033.phpt

diff --cc NEWS
index 2f3baaf8fb90e6ba63af995313dc02b7ae898329,24eaddce3e89318f9e5a31d90312cd14cbdbabe1..50ed9a6c14ee62479eb86f47d8871a42b93cd24d
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -6,29 -6,12 +6,32 @@@ PH
    . Fixed bug #80523 (bogus parse error on >4GB source code). (Nikita)
    . Fixed bug #80384 (filter buffers entire read until file closed). (Adam
      Seitz, cmb)
 +  . Fixed bug #80596 (Invalid union type TypeError in anonymous classes).
 +    (Daniil Gentili)
 +  . Fixed bug #80617 (GCC throws warning about type narrowing in
 +    ZEND_TYPE_INIT_CODE). (Nikita)
 +
 +- BCMath:
 +  . Fixed bug #80545 (bcadd('a', 'a') doesn't throw an exception).
 +    (Jens de Nies)
  
+ - Curl:
+   . Fixed bug #80595 (Resetting POSTFIELDS to empty array breaks request). (cmb)
  - Date:
 -  . Fixed bug #80376 (last day of the month causes runway cpu usage. (Derick)
 +  . Fixed bug #80376 (last day of the month causes runway cpu usage). (Derick)
 +
 +- DOM:
 +  . Fixed bug #80537 (Wrong parameter type in DOMElement::removeAttributeNode
 +    stub). (Nikita)
 +
 +- Filter:
 +  . Fixed bug #80584 (0x and 0X are considered valid hex numbers by
 +    filter_var()). (girgias)
 +
 +- GMP:
 +  . Fixed bug #80560 (Strings containing only a base prefix return 0 object).
 +    (girgias)
  
  - MySQLi:
    . Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
index f01f6f775a22a11e435ddb0b7958c0dedc470257,7faf439ce17cd614554eabd842c047262286baeb..82d97053eed3a7dbbe120c9c56ba7b23d6d188bf
@@@ -2721,9 -2968,17 +2721,16 @@@ static int _php_curl_setopt(php_curl *c
                        break;
  
                case CURLOPT_POSTFIELDS:
 -                      if (Z_TYPE_P(zvalue) == IS_ARRAY || Z_TYPE_P(zvalue) == IS_OBJECT) {
 +                      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 {
 -#if LIBCURL_VERSION_NUM >= 0x071101
                                zend_string *tmp_str;
                                zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
                                /* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
Simple merge