diff --git a/ext/curl/interface.c b/ext/curl/interface.c index d03f81b249b..fdf855278ee 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1088,6 +1088,7 @@ PHP_MINIT_FUNCTION(curl) #endif #if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */ + REGISTER_CURL_CONSTANT(CURL_VERSION_CURLDEBUG); REGISTER_CURL_CONSTANT(CURLOPT_SSH_KNOWNHOSTS); #endif @@ -1292,6 +1293,7 @@ PHP_MINIT_FUNCTION(curl) #if LIBCURL_VERSION_NUM >= 0x072f00 /* Available since 7.47.0 */ REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2TLS); + REGISTER_CURL_CONSTANT(CURL_VERSION_PSL); #endif #if LIBCURL_VERSION_NUM >= 0x073000 /* Available since 7.48.0 */ @@ -1410,6 +1412,10 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLOPT_TLS13_CIPHERS); #endif +#if LIBCURL_VERSION_NUM >= 0x074001 /* Available since 7.64.1 */ + REGISTER_CURL_CONSTANT(CURL_VERSION_ALTSVC); +#endif + REGISTER_CURL_CONSTANT(CURLOPT_SAFE_UPLOAD); #ifdef PHP_CURL_NEED_OPENSSL_TSL diff --git a/ext/curl/sync-constants.php b/ext/curl/sync-constants.php index 08d2d28460e..2db773d5f80 100755 --- a/ext/curl/sync-constants.php +++ b/ext/curl/sync-constants.php @@ -18,6 +18,8 @@ const IGNORED_CONSTANTS = [ 'CURLOPT_PROGRESSDATA' ]; +const CONSTANTS_REGEX_PATTERN = '~^CURL(?:OPT|_VERSION)_[A-Z0-9_]+$~'; + $curlConstants = getCurlConstants(); $sourceConstants = getSourceConstants(); @@ -158,13 +160,8 @@ function getCurlConstants() : array $deprecated = $match[3] ?? null; $removed = $match[4] ?? null; - if (strpos($name, 'CURLOPT_') !== 0) { - // not a CURLOPT_* constant - continue; - } - - if (in_array($name, IGNORED_CONSTANTS)) { - // purposefully ignored constant + if (in_array($name, IGNORED_CONSTANTS, true) || !preg_match(CONSTANTS_REGEX_PATTERN, $name)) { + // not a wanted constant continue; } @@ -198,8 +195,8 @@ function getSourceConstants() : array continue; } - if (strpos($name, 'CURLOPT_') !== 0) { - // not a CURLOPT_* constant + if (!preg_match(CONSTANTS_REGEX_PATTERN, $name)) { + // not a wanted constant continue; } diff --git a/ext/curl/tests/bug72189.phpt b/ext/curl/tests/bug72189.phpt new file mode 100644 index 00000000000..6723c2aae65 --- /dev/null +++ b/ext/curl/tests/bug72189.phpt @@ -0,0 +1,49 @@ +--TEST-- +Request #72189 (Add missing CURL_VERSION_* constants) +--SKIPIF-- += 7.19.6'); +} + +?> +--FILE-- + 0); + +?> +--EXPECT-- +bool(true)