PHP 8.4: Curl: CURLOPT_BINARYTRANSFER deprecated

Version8.4
TypeDeprecation

The CURLOPT_BINARYTRANSFER constant provided by the Curl extension is deprecated in PHP 8.4. This constant had no effect since PHP 5.1.2. It was long overdue to deprecate and remove this constant.

Any PHP application that runs on PHP versions later than 5.1.2 can safely remove the curl_setopt because setting this option did not have any impact in the first place.

- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
 curl_setopt($ch, [
   CURLOPT_URL => 'https://php.watch/versions/8.4',
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_FOLLOWLOCATION => true,
-  CURLOPT_BINARYTRANSFER => true,
 ]);

Backward Compatibility Impact

Using the CURLOPT_BINARYTRANSFER in PHP 8.4 and later emits a deprecation notice:

Deprecated: Constant CURLOPT_BINARYTRANSFER is deprecated

It is safe to remove the curl_setopt calls or curl_setopt_array array values containing the CURLOPT_BINARYTRANSFER constant, and it will have no impact.


Implementation