Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -748,4 +751,3 @@ LDAP:

. The cyclic GC has been enhanced, which may result in considerable performance
improvements.

12 changes: 12 additions & 0 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,18 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_VERSION_SSL);
REGISTER_CURL_CONSTANT(CURL_VERSION_SSPI);

#if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */
REGISTER_CURL_CONSTANT(CURL_VERSION_CURLDEBUG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is an old constant, I wonder if it was omitted intentionally. The curl docs do say "This is mainly of interest for libcurl hackers". But I don't see any particular problem with exposing it either...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @bagder for thoughts about exposing it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's indeed part of the public API, exposed to the world just like the other bits there so I have no objections.

If it actually is useful to anyone is another matter...

#endif

#if LIBCURL_VERSION_NUM >= 0x072f00 /* Available since 7.47.0 */
REGISTER_CURL_CONSTANT(CURL_VERSION_PSL);
#endif

#if LIBCURL_VERSION_NUM >= 0x074001 /* Available since 7.64.1 */
REGISTER_CURL_CONSTANT(CURL_VERSION_ALTSVC);
#endif

/* Available since 7.10.6 */
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
/* http authentication options */
Expand Down
15 changes: 6 additions & 9 deletions ext/curl/sync-constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
'CURLOPT_PROGRESSDATA'
];

const CONSTANTS_REGEX_PATTERN = '~^CURL(?:OPT|_VERSION)_[A-Z0-9_]+$~';

$curlConstants = getCurlConstants();
$sourceConstants = getSourceConstants();

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
49 changes: 49 additions & 0 deletions ext/curl/tests/bug72189.phpt
Original file line number Diff line number Diff line change
@@ -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)