-
Notifications
You must be signed in to change notification settings - Fork 504
PHP 8.5: Prevent deprecation notices for curl_close #947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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! |
curl_close
is 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:
examples
directory.docs
directory.If the documentation is in a new markdown file, I have added a link to this new file to the Docs folder
README.md
file.