From: Christoph M. Becker Date: Mon, 18 Jan 2021 10:01:01 +0000 (+0100) Subject: Merge branch 'PHP-7.4' into PHP-8.0 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c321896a372c3358663f2f1e8721c61c46634a0c;p=php Merge branch 'PHP-7.4' into PHP-8.0 * PHP-7.4: Fix #80595: Resetting POSTFIELDS to empty array breaks request --- c321896a372c3358663f2f1e8721c61c46634a0c diff --cc NEWS index 2f3baaf8fb,24eaddce3e..50ed9a6c14 --- a/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 diff --cc ext/curl/interface.c index f01f6f775a,7faf439ce1..82d97053ee --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@@ -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 */