> Per the PHP documentation for CURLOPT_PROGRESSFUNCTION [1]:
>
> > deprecated as of cURL 7.32.0. Use CURLOPT_XFERINFOFUNCTION instead.
>
> The cURL page for this option also states that it is deprecated since 7.32.0. 
> [2]
>
> It probably would be good to update the RFC to clarify this.
>
> Sincerely,
> Theodore
>
> [1]: 
> https://www.php.net/manual/en/curl.constants.php#constant.curlopt-progressfunction
> [2]: https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html


Although libcurl documents `CURLOPT_PROGRESSFUNCTION` and
`CURLOPT_XFERINFOFUNCTION` as separate options, they are effectively
the same kind of API from PHP userland’s perspective: both register a
progress callback and use the same return convention to abort a
transfer. Because of that, ext/curl could internally map
`CURLOPT_PROGRESSFUNCTION` to libcurl’s `CURLOPT_XFERINFOFUNCTION`
instead of introducing a PHP deprecation for the legacy constant.

The only `CURL*` PHP constant we deprecated in PHP was
`CURLOPT_BINARYTRANSFER`[^1], which had very small usage then and was
already a no-op option. In PHP 5.6, six constants[^4] were removed.
Since this constant is used frequently, and we can rewrite it to use
`XFERINFOFUNCTION`, we can simplify things for hundreds of library
maintainers. This is especially true because
`CURLOPT_PROGRESSFUNCTION` and `CURLOPT_XFERINFOFUNCTION` are
practically identical within PHP.

We already maintain BC for constants deprecated in libcurl, but still
support them in PHP without any deprecation notices:

 - CURLINFO_HTTP_CODE[^2] (deprecated in libcurl 7.10.8)
 - CURLOPT_ENCODING[^3] (deprecated in libcurl 7.21.6)

The only Curl constant I'd propose to deprecate would be
CURLE_OBSOLETE[^5]. It is still declared in PHP but is no longer[^6]
used in libcurl.

[^1]: https://php.watch/codex/CURLOPT_BINARYTRANSFER
[^2]: https://php.watch/codex/CURLINFO_HTTP_CODE
[^3]: https://php.watch/codex/CURLOPT_ENCODING
[^4]: https://php.watch/codex?search=CURL
[^5]: https://php.watch/codex/CURLE_OBSOLETE
[^6]: https://github.com/curl/curl/blob/master/include/curl/curl.h

Reply via email to