Update Curl is_resource() to work with PHP 8 CurlHandle and CurlMultiHandle objects#2715
Update Curl is_resource() to work with PHP 8 CurlHandle and CurlMultiHandle objects#2715Nyholm merged 2 commits intoguzzle:masterfrom Ayesh:php8-curlhandle-fix
Conversation
|
Could you make sure we test this on php8 too? |
|
PHP 8 is pending #2712 first, to avoid conflicts and to ensure the dependencies work on PHP 8. |
|
This needs rebasing. :) |
Updates `is_resource()` calls for curl handlers to properly work with PHP 8's `\CurlHandle` and `\CurlMultiHandle` objects. See https://php.watch/versions/8.0/resource-CurlHandle PHPDoc comments are updated to indicate that the variable/property can be either a resource or a Curl object.
|
Thank you @Nyholm and @GrahamCampbell - I just force-pushed after rebasing from current |
|
Could you also make sure the CI is green? |
|
Both test failures are due to the PHP 8's changes in parameter types. I suppose both static analyzers infer the parameter types via Reflection. It wouldn't be ideal if we were to make psalm/phpstan suppress these errors, but that's the only approach I can think of for now. Even if were to run the static analyzers on PHP 8, it would now complain about the other type of parameters too. |
|
I will make changes in psalm/phpstan config files so it ignores the type mismatch false positives. |
|
I agree with you. Let's update the baselines for now. |
|
Thanks for updating the baselines, it wasn't something I had a lot of experience. |
|
I ran the following commands: |
|
Thank you for your work and for the reviews |
I was about to suggest to add this to This could be unnecessary friction for newcomers, can't expect everyone to know the ins/outs of all the tools I guess, at least when it comes to handling things like updating the baseline. Any ideas how to make this easier? 🤔 |
|
Running these commands are rare. Newcomers will never run this. |
Updates
is_resource()calls for curl handlers to properly work with PHP 8's\CurlHandleand\CurlMultiHandleobjects.See https://php.watch/versions/8.0/resource-CurlHandle
PHPDoc comments are updated to indicate that the variable/property can be either a resource or a Curl object.
In PHP 8,
curl_close()calls are no-op, and and explicitunset()call is added to ensure the\CurlHandleobject is destroyed.This PR depends on #2714 (to enable tests).
Related: #2702
On manual/forced PHP 8 tests, there are two failures related to this repo (and 10 errors related to
promises).This PR fixes the two failures related to this repo: