Remove $age parameter of curl_version()
| From: | Christoph M. Becker | Date: | Wed, 01 May 2019 17:18:41 +0000 |
| Subject: | Remove $age parameter of curl_version() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-105548@lists.php.net to get a copy of this message | ||
Hi,
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>
--
Christoph M. Becker