On Wed, May 1, 2019 at 1:18 PM Christoph M. Becker <cmbecke...@gmx.de> 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. > It looks like the ext/curl binding [1] handles run-time age values that differ from compile-time, as it makes checks for if (d->age). Am I missing something? > 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? > Well, what about: if (false === curl_version(3)) { throw new \Exception('Please rebuild PHP with curl at least version 7.16.1'); } Here the developer has used age as a proxy to a major release point of curl, as opposed to say: if (version_compare(curl_version()['version'], '7.16.1', '<') { throw new Exception...; } [1]: https://github.com/php/php-src/blob/master/ext/curl/interface.c#L1824