-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/curl: Add feature_info
assoc array to curl_version()
#13439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvorisek
reviewed
Feb 20, 2024
b5eb1f8
to
17c07f3
Compare
Girgias
reviewed
Feb 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me
The `phpinfo()` section of the Curl extension lists individual features supported by the particular ext-Curl + libcurl build. However, the `curl_version()` function return values do not indicate the same level of details. `curl_version()` has a `protocols` key that returns an array of all protocols supported by the build. But the `features` key is a bitmask of all the features. Checking the availability of certain feature requires knowing the corresponding `CURL_VERSION` constant, and checking the availability of the constant and a bitmask check for it in the `features` value. For example, to determine HTTP2 support, it requires evaluating: ```php defined('CURL_VERSION_HTTP2') && (curl_version()['features'] & CURL_VERSION_HTTP2 === CURL_VERSION_HTTP2) ``` To make feature availability checks more intuitive, this adds a new `feature_list` key to `curl_version()` output array. With it, checking for individual features availability is easier, and does not require inspecting the availability of the `CURL_VERSION` constant and the `features` key. ```php !empty(curl_version()['feature_list']['HTTP2']); ```
17c07f3
to
a44f341
Compare
Girgias
approved these changes
Feb 21, 2024
Thank you 🙏 |
Ayesh
added a commit
to Ayesh/doc-en
that referenced
this pull request
Nov 14, 2024
Commit: php/php-src#13439 PHP.Watch: [PHP 8.4: Curl: `curl_version()` `feature_list` support](https://php.watch/versions/8.4/curl_version-feature_list)
Ayesh
added a commit
to Ayesh/doc-en
that referenced
this pull request
Nov 15, 2024
Commit: php/php-src#13439 PHP.Watch: [PHP 8.4: Curl: `curl_version()` `feature_list` support](https://php.watch/versions/8.4/curl_version-feature_list)
Ayesh
added a commit
to Ayesh/doc-en
that referenced
this pull request
Nov 15, 2024
Commit: php/php-src#13439 PHP.Watch: [PHP 8.4: Curl: `curl_version()` `feature_list` support](https://php.watch/versions/8.4/curl_version-feature_list)
Ayesh
added a commit
to Ayesh/doc-en
that referenced
this pull request
Nov 16, 2024
Commit: php/php-src#13439 PHP.Watch: [PHP 8.4: Curl: `curl_version()` `feature_list` support](https://php.watch/versions/8.4/curl_version-feature_list)
Girgias
pushed a commit
to php/doc-en
that referenced
this pull request
Nov 16, 2024
Commit: php/php-src#13439 PHP.Watch: [PHP 8.4: Curl: `curl_version()` `feature_list` support](https://php.watch/versions/8.4/curl_version-feature_list)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
phpinfo()
section of the Curl extension lists individual features supported by the particular ext-Curl + libcurl build. However, thecurl_version()
function return values do not indicate the same level of details.curl_version()
has aprotocols
key that returns an array of all protocols supported by the build. But thefeatures
key is a bitmask of all the features. Checking the availability of certain feature requires knowing the correspondingCURL_VERSION
constant, and checking the availability of the constant and a bitmask check for it in thefeatures
value.For example, to determine HTTP2 support, it requires evaluating:
To make feature availability checks more intuitive, this adds a new
feature_list
key tocurl_version()
output array.With it, checking for individual features availability is easier, and does not require inspecting the availability of the
CURL_VERSION
constant and thefeatures
key.