PHP is migrating away from resource type, replacing it with opaque (i.e. no userland-visible methods or properties) classes. This means that code like this will break:
$curl = curl_init( 'http://example.com' ); if ( !is_resource( $curl ) ) { die( 'Something horrible happened' ); }
It will always report errors because the handle is not a resource anymore:
>>> var_dump( $curl ); object(CurlHandle)#1 (0) { }
Instead, return values should be used like this:
if ( !$curl ) { ... }
or
if ( $curl === false ) { ... }
The current progress of PHP's migration can be tracked here. As of PHP 8.0 feature freeze, the following extensions have been migrated:
- curl
- openssl
- shmop
- sockets
- sysvmsg
- sysvsem
- sysvshm
- xmlrpc
- zip
- zlib
The rest will be done in 8.1 or later, but to avoid having another pass at it and make the code more future-proof, all uses of is_resource() should be removed.