From fc16285538e96ecb35d017231051f83dcbd8b55b Mon Sep 17 00:00:00 2001 From: hanshenrik Date: Wed, 10 Jan 2024 10:41:24 +0100 Subject: [PATCH] ext/curl: deprecate CURLOPT_BINARYTRANSFER This is long overdue, CURLOPT_BINARYTRANSFER has been a no-op since PHP5.1.2 in 2004 (ref https://bugs.php.net/bug.php?id=55635 ) Close GH-13114. --- NEWS | 3 +++ UPGRADING | 3 +++ ext/curl/curl.stub.php | 1 + ext/curl/curl_arginfo.h | 4 ++-- ext/curl/tests/bug46711.phpt | 3 ++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 0d731289597ad..b5a58fd7a1f93 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ Core: . Enabled ifunc checks on FreeBSD from the 12.x releases. (Freaky) . Changed the type of PHP_DEBUG and PHP_ZTS constants to bool. (haszi) +Curl: + . Deprecated the CURLOPT_BINARYTRANSFER constant. (divinity76) + Date: . Added DateTime[Immutable]::createFromTimestamp. (Marc Bennewitz) diff --git a/UPGRADING b/UPGRADING index 0cd2dc3007fff..17d508487cfb0 100644 --- a/UPGRADING +++ b/UPGRADING @@ -177,6 +177,9 @@ PHP 8.4 UPGRADE NOTES 4. Deprecated Functionality ======================================== +- Curl: + . The CURLOPT_BINARYTRANSFER constant is deprecated. + - Date: . Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated. Use DatePeriod::createFromISO8601String() instead. diff --git a/ext/curl/curl.stub.php b/ext/curl/curl.stub.php index 05ce48640380f..1726d4b50736d 100644 --- a/ext/curl/curl.stub.php +++ b/ext/curl/curl.stub.php @@ -13,6 +13,7 @@ const CURLOPT_AUTOREFERER = UNKNOWN; /** * @var int + * @deprecated has no effect since 5.1.2 * @cvalue CURLOPT_BINARYTRANSFER */ const CURLOPT_BINARYTRANSFER = UNKNOWN; diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h index d702de608a908..f868ad505021d 100644 --- a/ext/curl/curl_arginfo.h +++ b/ext/curl/curl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d524d2fd58e484682c860d8a72eafc9a7d544911 */ + * Stub hash: aebc4c2673203a4af49f55dd6eaf0bdbb4cafd68 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_close, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0) @@ -233,7 +233,7 @@ static const zend_function_entry class_CurlShareHandle_methods[] = { static void register_curl_symbols(int module_number) { REGISTER_LONG_CONSTANT("CURLOPT_AUTOREFERER", CURLOPT_AUTOREFERER, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CURLOPT_BINARYTRANSFER", CURLOPT_BINARYTRANSFER, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CURLOPT_BINARYTRANSFER", CURLOPT_BINARYTRANSFER, CONST_PERSISTENT | CONST_DEPRECATED); REGISTER_LONG_CONSTANT("CURLOPT_BUFFERSIZE", CURLOPT_BUFFERSIZE, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_CAINFO", CURLOPT_CAINFO, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_CAPATH", CURLOPT_CAPATH, CONST_PERSISTENT); diff --git a/ext/curl/tests/bug46711.phpt b/ext/curl/tests/bug46711.phpt index f83c64b46430b..a0b211a7876ab 100644 --- a/ext/curl/tests/bug46711.phpt +++ b/ext/curl/tests/bug46711.phpt @@ -20,7 +20,8 @@ foreach( $opt as $option => $value ) { var_dump($opt); // with this bug, $opt[58] becomes NULL ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Constant CURLOPT_BINARYTRANSFER is deprecated in %s on line %d array(2) { [58]=> bool(true)