History log of /PHP-8.4/ext/curl/tests/curl_version_features-array.phpt (Results 1 – 2 of 2)
Revision Date Author Comments
# 824c8160 24-Oct-2024 Bob Weinand

Fix test without extra curl features

The empty line would otherwise be required in the test and make it fail.


# ba0f9fb5 21-Feb-2024 Ayesh Karunaratne

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 + libcu

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']);
```

show more ...