From 564818c7d5c67f968637ef61ec31b90b224b4658 Mon Sep 17 00:00:00 2001 From: hanshenrik Date: Wed, 10 Jan 2024 10:41:24 +0100 Subject: [PATCH 1/2] 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 ) --- ext/curl/curl_arginfo.h | 2 +- ext/curl/tests/bug46711.phpt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h index d702de608a908..76c81efd67394 100644 --- a/ext/curl/curl_arginfo.h +++ b/ext/curl/curl_arginfo.h @@ -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) From 823c377f762b128e1e4ebc8f6f3dc1664e307b96 Mon Sep 17 00:00:00 2001 From: hanshenrik Date: Wed, 10 Jan 2024 11:08:42 +0100 Subject: [PATCH 2/2] gen_stub.php deprecate CURLOPT_BINARYTRANSFER from codereview https://github.com/php/php-src/pull/13114#discussion_r1447137681 --- ext/curl/curl.stub.php | 1 + ext/curl/curl_arginfo.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 76c81efd67394..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)