diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-28 10:47:52 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-28 10:48:59 +0100 |
commit | 6d1dff6f3d64844bdb60ba65f64a4d1a5c47ee6c (patch) | |
tree | 0e06c9504a7637dfd830cceb38fc503b05f602fd | |
parent | 32cd373dfd4e5b5710929c534f960694853a02e0 (diff) | |
parent | c47b18a222ceb1d78810d2822170cbf6e110a98c (diff) | |
download | php-git-6d1dff6f3d64844bdb60ba65f64a4d1a5c47ee6c.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix #79033: Curl timeout error with specific url and post
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/curl/interface.c | 10 | ||||
-rw-r--r-- | ext/curl/tests/bug79033.phpt | 29 |
3 files changed, 38 insertions, 4 deletions
@@ -17,6 +17,9 @@ PHP NEWS . Fixed bug #79008 (General performance regression with PHP 7.4 on Windows). (cmb) +- CURL: + . Fixed bug #79033 (Curl timeout error with specific url and post). (cmb) + - Fileinfo: . Fixed bug #74170 (locale information change after mime_content_type). (Sergei Turchanov) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 6a25359597..39d74b27d1 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2754,7 +2754,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 @@ -2769,9 +2769,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 diff --git a/ext/curl/tests/bug79033.phpt b/ext/curl/tests/bug79033.phpt new file mode 100644 index 0000000000..98a97ed7a4 --- /dev/null +++ b/ext/curl/tests/bug79033.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #79033 (Curl timeout error with specific url and post) +--SKIPIF-- +<?php include 'skipif.inc'; ?> +--FILE-- +<?php +include 'server.inc'; +$host = curl_cli_server_start(); +$ch = curl_init(); +curl_setopt_array($ch, [ + CURLOPT_URL => "{$host}/get.inc?test=post", + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => [], + CURLINFO_HEADER_OUT => true, + CURLOPT_RETURNTRANSFER => true, +]); +var_dump(curl_exec($ch)); +var_dump(curl_getinfo($ch)["request_header"]); +?> +--EXPECTF-- +string(%d) "array(0) { +} +" +string(90) "POST /get.inc?test=post HTTP/1.1 +Host: localhost:%d +Accept: */* +Content-Length: 0 + +" |