Closed Ilyes512 closed 3 years ago
There is no way for us to fix it, this is a BC break in PHP made in a major version and that is their right to do. PHP core has made clear that is_resource
will not be changed to check for new resource object types in the past, so we are going with this direction.
So with PHP 8 we got some backwards incompatible changes regarding
is_resource()
. For example curl_init does not return an resource anymore but an object and sois_resource
will fail (return false). See https://php.watch/versions/8.0/resource-CurlHandleSo I am trying to use a library that uses this library to check the result of a curl_init call: link. So the first article mentioned that a backwards compatible way of checking if the resource was successfully created is by checking if it equals false
if ($ch === false) {}
.Now I am not sure if
Assertion::isResource
can be updated to check for false values for all kinds of resources? I believe you only check if it's false when it regards functions that return objects instead of resources since php 8.So how should I deal with this? Should there be a new specific assertions (Assertion::isCurlResource)? Should it not use this library at all when checking curl resources?