Re: Remove $age parameter of curl_version()
| From: | Christoph M. Becker | Date: | Fri, 03 May 2019 10:44:59 +0000 |
| Subject: | Re: Remove $age parameter of curl_version() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105580@lists.php.net to get a copy of this message | ||
On 01.05.2019 at 19:18, Christoph M. Becker wrote:
> curl_version()[1] (of ext/curl) makes curl_version_info()[2] (of
> libcurl) available to PHP userland. The latter requires to pass an age
> argument which usually is CURLVERSION_NOW, so that the information
> returned by the runtime matches the declarations used during compile
> time. For C programs it is simply necessary to pass this information,
> and it might make sense to pass something else than CURLVERSION_NOW, but
> the PHP wrapper assumes that the return value of curl_version_info()
> matches the compile time declarations anyway, so passing anything else
> might give bad results.
>
> Therefore I suggest to remove this parameter in the long run altogether.
> For PHP 7.4 I suggest to deprecate using the parameter, and also to
> ignore anything that is not CURLVERSION_NOW, and to raise a warning in
> this case. I.e. something like the following behavior:
>
> // okay
> curl_version();
>
> // E_DEPRECATED: passing an argument is deprecated
> curl_version(CURLVERSION_NOW);
>
> // E_WARNING: argument ignored
> curl_version($not_curlversion_now);
>
> Thoughts? Do I overlook something important?
>
> [1]
> <https://www.php.net/manual/en/function.curl-version.php>
> [2]
> <https://curl.haxx.se/libcurl/c/curl_version_info.html>
I have submitted PR #4106[3] to address this issue. Of course, ignoring
anything else than CURLVERSION_NOW would be a BC break, and is as such
debatable. Also, the deprecation should be followed by an actual
removal sometime in the future, so likely there should be a respective
RFC -- or can we do without in this case?
[3] <https://github.com/php/php-src/pull/4106>
--
Christoph M. Becker