PHP 8.5: Prevent deprecation notices for curl_close#947
PHP 8.5: Prevent deprecation notices for curl_close#947schlessera merged 1 commit intoWordPress:developfrom
Conversation
There was a problem hiding this comment.
@TobiasBg Thanks for this PR.
The change on line 326 looks valid, but the other two changes are redundant. The conditions already check if $this->handle is a resource and that condition would return false as of PHP 8.0 (as it would be an object, not a resource), so adding an additional version comparison will not make a difference...
|
P.s.: probably better to change the version comparison on line 326 to a check for |
`curl_close` is deprecated in PHP 8.5+, and hasn't been doing anything since PHP 8.0, when handles were switched from `resource` to `object`. To prevent deprecation warnings it should therefore be called on older versions of PHP only, where handles are `resource`s. See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_no-op_functions_from_the_resource_to_object_conversion.
|
Oh, thanks @jrfnl! Good to know about the I have updated the PR, to only leave that one line, with an |
It helps to understand a deprecation before addressing it... Not sure if you pulled similar PRs elsewhere, but if so, you may want to update those too... |
|
Yes, checked those already. Thanks. I think that including the PHP version check can be helpful in the future, when support for older versions of PHP is dropped in projects. |
I don't agree. That's what comments are for, or one could open an issue with a tasklist as a reminder of things which would need to be done in the future, but the code itself should be based on what makes it most stable. Considering that people can compile custom versions of PHP with different version of extensions (no matter how unlikely it is for anyone to do that in this case), the |
|
Great points and arguments! Changed my mind :-) Thanks! |
|
Thanks for your PR, @TobiasBg ! |
curl_closeis deprecated in PHP 8.5+, and hasn't been doing anything since PHP 8.0.To prevent deprecation warnings it should therefore be called on older versions of PHP only.
See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_no-op_functions_from_the_resource_to_object_conversion.
Pull Request Type
This is a:
Quality assurance
Documentation
For new features:
examplesdirectory.docsdirectory.If the documentation is in a new markdown file, I have added a link to this new file to the Docs folder
README.mdfile.