com php-src: Add more missing CURL_VERSION_* constants: UPGRADING ext/curl/interface.c ext/curl/sync-constants .php ext/curl/tests/bug72189.phpt

From: Date: Thu, 02 May 2019 13:11:42 +0000
Subject: com php-src: Add more missing CURL_VERSION_* constants: UPGRADING ext/curl/interface.c ext/curl/sync-constants .php ext/curl/tests/bug72189.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106019@lists.php.net to get a copy of this message
Commit: 6b73e692c976bdfdc710741cd983a9b33c13b3e7 Author: Javier Spagnoletti <phansys@gmail.com> Tue, 30 Apr 2019 14:12:39 -0300 Committer: Nikita Popov <nikita.ppv@gmail.com> Thu, 2 May 2019 15:11:42 +0200 Parents: d91b643c87cb6ff91ee1792ef430bfb92bf00581 Branches: PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6b73e692c976bdfdc710741cd983a9b33c13b3e7 Log: Add more missing CURL_VERSION_* constants And also check for CURL_VERSION_* constants in the sync-constants.php script. Related to request #72189: Add missing CURL_VERSION_* constants. Bugs: https://bugs.php.net/72189 Changed paths: M UPGRADING M ext/curl/interface.c M ext/curl/sync-constants.php A ext/curl/tests/bug72189.phpt Diff: diff --git a/UPGRADING b/UPGRADING index 0e44c49..effc066 100644 --- a/UPGRADING +++ b/UPGRADING @@ -622,9 +622,11 @@ Curl: . CURL_SSLVERSION_MAX_TLSv1_2 . CURL_SSLVERSION_MAX_TLSv1_3 . CURL_SSLVERSION_TLSv1_3 + . CURL_VERSION_ALTSVC . CURL_VERSION_ASYNCHDNS . CURL_VERSION_BROTLI . CURL_VERSION_CONV + . CURL_VERSION_CURLDEBUG . CURL_VERSION_DEBUG . CURL_VERSION_GSSAPI . CURL_VERSION_GSSNEGOTIATE @@ -634,6 +636,7 @@ Curl: . CURL_VERSION_MULTI_SSL . CURL_VERSION_NTLM . CURL_VERSION_NTLM_WB + . CURL_VERSION_PSL . CURL_VERSION_SPNEGO . CURL_VERSION_SSPI . CURL_VERSION_TLSAUTH_SRP @@ -729,7 +732,7 @@ LDAP: - mbstring.regex_stack_limit . New INI directive (since 7.3.6) limiting stack depth of mbstring/oniguruma - regular expressions. + regular expressions. ======================================== 12. Windows Support @@ -748,4 +751,3 @@ LDAP: . The cyclic GC has been enhanced, which may result in considerable performance improvements. - \ No newline at end of file diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 11b6127..bb038dc 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1130,6 +1130,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 @@ -1334,6 +1335,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 */ @@ -1452,6 +1454,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 093483e..f8f7ba4 100644 --- a/ext/curl/sync-constants.php +++ b/ext/curl/sync-constants.php @@ -17,6 +17,8 @@ const IGNORED_CONSTANTS = [ 'CURLOPT_PROGRESSDATA' ]; +const CONSTANTS_REGEX_PATTERN = '~^CURL(?:OPT|_VERSION)_[A-Z0-9_]+$~'; + $curlConstants = getCurlConstants(); $sourceConstants = getSourceConstants(); @@ -157,13 +159,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; } @@ -197,8 +194,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 0000000..6723c2a --- /dev/null +++ b/ext/curl/tests/bug72189.phpt @@ -0,0 +1,49 @@ +--TEST-- +Request #72189 (Add missing CURL_VERSION_* constants) +--SKIPIF-- +<?php + +include 'skipif.inc'; + +$version = curl_version(); + +if ($version['version_number'] < 0x071306) { + exit('skip: test works only with curl >= 7.19.6'); +} + +?> +--FILE-- +<?php + +$version = curl_version(); + +$bitfields = [ + CURL_VERSION_ASYNCHDNS, + CURL_VERSION_CONV, + CURL_VERSION_CURLDEBUG, + CURL_VERSION_DEBUG, + CURL_VERSION_GSSNEGOTIATE, + CURL_VERSION_IDN, + CURL_VERSION_IPV6, + CURL_VERSION_KERBEROS4, + CURL_VERSION_LARGEFILE, + CURL_VERSION_LIBZ, + CURL_VERSION_NTLM, + CURL_VERSION_SPNEGO, + CURL_VERSION_SSL, + CURL_VERSION_SSPI, +]; + +$matchesCount = 0; + +foreach ($bitfields as $feature) { + if ($version['features'] & $feature) { + ++$matchesCount; + } +} + +var_dump($matchesCount > 0); + +?> +--EXPECT-- +bool(true)

« previous php.cvs (#106019) next »