Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105549 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44235 invoked from network); 1 May 2019 20:38:03 -0000 Received: from unknown (HELO mail-vs1-f42.google.com) (209.85.217.42) by pb1.pair.com with SMTP; 1 May 2019 20:38:03 -0000 Received: by mail-vs1-f42.google.com with SMTP id e2so10219091vsc.13 for ; Wed, 01 May 2019 10:40:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=MlMsVURhEq1PBdmVZg9sQuMnuzP7LU5W6YdozTQ0Yic=; b=lFz7wyvjRtmD2GbbeBYliQqknGfOmAJPMTp9kn6QmX3Iip7nr3SSJqxudEC0b0Dddf 1+fEPopBEUHboa1Hvev2/JRHI92bW7timzdmTb58K3TReviQi0vz5Bgp47tUxfCsC+dZ RLIWy45tErIPNNaKBZG4o8MC6l+6BHoIAk6j9lsIiJUy01/2bOk85fYYDpVzcSHfFhsk ZsCJSfaU+2KD/fLLMdS8yvIFoGPO1pUPBfdbMdk+kR35YHoZaSx5n+/IPS4v83ixBYGo dQRnjCEmacxYN4P0/6+beMQ6BW4JUFisgzudNn07mb7iraE3PKyQPMHLhBGvSw4BS83c vgxQ== X-Gm-Message-State: APjAAAWTkyYQhr6Xko26snNQ/iKlRuptiHF01uL0AapPf0bxFq1qZYBD 42SU+uBGy35SzvAHQGsdW9zh7myKaR5UrFq9Zb4= X-Google-Smtp-Source: APXvYqy7ffXrdEDM5HxgCVc0fRyaM/7P17h7TIcyyJRoIyeaQxDta5qkN4xxb/CsZMMLeXbq6aRLp+rhBc8HGuAAvko= X-Received: by 2002:a67:f688:: with SMTP id n8mr3183333vso.174.1556732429358; Wed, 01 May 2019 10:40:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: bishop@php.net Date: Wed, 1 May 2019 13:40:04 -0400 Message-ID: To: "Christoph M. Becker" Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000767cf40587d70357" Subject: Re: [PHP-DEV] Remove $age parameter of curl_version() From: bishop@php.net (Bishop Bettini) --000000000000767cf40587d70357 Content-Type: text/plain; charset="UTF-8" On Wed, May 1, 2019 at 1:18 PM 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. > 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 --000000000000767cf40587d70357--