Re: BC breaking changes in PHP 8.1
| From: | Rowan Tommins | Date: | Thu, 23 Sep 2021 17:47:31 +0000 |
| Subject: | Re: BC breaking changes in PHP 8.1 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116149@lists.php.net to get a copy of this message | ||
On 23/09/2021 17:52, Nikita Popov wrote:
If we dropped all non-deprecation changes from PHP 8.1, the upgrade would be a bit easier, but not by much. This is not where the main cost is.Be that as it may, the question remains whether *the particular case of is_resource() and get_resource_type()* could be made easier. Was the option of having a "Resource" base class or interface ever discussed? If it had a method called something like "getResourceTypeString()" then get_resource_type() could do (the internal equivalent of): if ( is_resource($arg) ) { // current logic } elseif ( is_object($arg) && $arg instanceOf Resource ) {
return $arg->getResourceTypeString();} I suspect as 8.0 and then 8.1 gain adoption, there is going to be a lot of confusion around the resource -> object change. Most users probably don't really know what a "resource", they just know the boilerplate to use. Regards, -- Rowan Tommins [IMSoP]