From 72e1da81b6792d4141b4b41f6fc3e92b68aa0f3e Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 7 May 2019 17:05:07 +0200 Subject: [PATCH] Deprecate CURLPIPE_HTTP1 `CURLPIPE_HTTP1` is deprecated and has no effect as of cURL 7.62.0[1]. We therefore deprecate the PHP constant as well, and trigger a warning that it is no longer supported, if used against cURL 7.62.0 and up. [1] --- NEWS | 1 + UPGRADING | 2 ++ ext/curl/multi.c | 13 ++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index debd28573d..01d879f3b0 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,7 @@ PHP NEWS . Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected). (Pierrick) . Implemented FR #77711 (CURLFile should support UNICODE filenames). (cmb) + . Deprecated CURLPIPE_HTTP1. (cmb) - Date: . Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita) diff --git a/UPGRADING b/UPGRADING index 3f6dcb7427..1b54d10482 100644 --- a/UPGRADING +++ b/UPGRADING @@ -41,6 +41,8 @@ PHP 7.4 UPGRADE NOTES - Curl: . Attempting to serialize a CURLFile class will now generate an exception. Previously the exception was only thrown on unserialization. + . Using CURLPIPE_HTTP1 is deprecated, and is no longer supported as of cURL + 7.62.0. - Date: . Calling var_dump() or similar on a DateTime(Immutable) instance will no diff --git a/ext/curl/multi.c b/ext/curl/multi.c index bee05838fa..fafcad3263 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -564,8 +564,19 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue, case CURLMOPT_MAX_PIPELINE_LENGTH: case CURLMOPT_MAX_TOTAL_CONNECTIONS: #endif - error = curl_multi_setopt(mh->multi, option, zval_get_long(zvalue)); + { + zend_long lval = zval_get_long(zvalue); + + if (option == CURLMOPT_PIPELINING && (lval & 1)) { +#if LIBCURL_VERSION_NUM >= 0x073e00 /* 7.62.0 */ + php_error_docref(NULL, E_WARNING, "CURLPIPE_HTTP1 is no longer supported"); +#else + php_error_docref(NULL, E_DEPRECATED, "CURLPIPE_HTTP1 is deprecated"); +#endif + } + error = curl_multi_setopt(mh->multi, option, lval); break; + } #if LIBCURL_VERSION_NUM > 0x072D00 /* Available since 7.45.0 */ case CURLMOPT_PUSHFUNCTION: if (mh->handlers->server_push == NULL) { -- 2.40.0