php-src/ext/curl
Ayesh Karunaratne ba0f9fb501
ext/curl: Add feature_info assoc array to curl_version() (#13439)
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']);
```
2024-02-21 00:46:22 +00:00
..
tests ext/curl: Add feature_info assoc array to curl_version() (#13439) 2024-02-21 00:46:22 +00:00
config.m4 Fix linking ext/curl against OpenSSL (#13262) 2024-02-14 13:52:01 +01:00
config.w32 Allow PHP_CURL_APIs to be imported by DLLs 2020-11-24 14:12:39 +01:00
CREDITS
curl.stub.php ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259) 2024-01-31 13:48:17 +00:00
curl_arginfo.h Do not generate frameless info items when func info generation is disabled 2024-02-18 11:39:00 +01:00
curl_file.c Make lots of string pointers const (#10646) 2023-02-21 14:01:37 +00:00
curl_file.stub.php Use single line phpdoc in stubs where possible 2021-07-20 13:16:56 +02:00
curl_file_arginfo.h Do not generate frameless info items when func info generation is disabled 2024-02-18 11:39:00 +01:00
curl_private.h ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259) 2024-01-31 13:48:17 +00:00
interface.c ext/curl: Add feature_info assoc array to curl_version() (#13439) 2024-02-21 00:46:22 +00:00
multi.c ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259) 2024-01-31 13:48:17 +00:00
php_curl.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
share.c Revert "Port all internally used classes to use default_object_handlers" 2022-09-14 11:13:23 +02:00
sync-constants.php ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259) 2024-01-31 13:48:17 +00:00