On 01.05.2019 at 19:40, Bishop Bettini wrote:

> 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?

Indeed, as the binding is written, it's unlikely that bad results are
returned.  Still, using a newer "age" than available at compile time
will neither provide the PHP program more information, nor would using
an older "age" have real benefits.

>> 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');
> }

It seems to me that wouldn't work anyway, since curl_version() only
returns false if curl_version_info() returned NULL, but that won't
happen[2].

> [1]: https://github.com/php/php-src/blob/master/ext/curl/interface.c#L1824

[2]
<https://github.com/curl/curl/blob/d1b5cf830bfe169745721b21245d2217d2c2453e/lib/version.c#L390-L463>

--
Christoph M. Becker

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to