Re: BC breaking changes in PHP 8.1
| From: | Nicolas Grekas | Date: | Sun, 26 Sep 2021 13:00:25 +0000 |
| Subject: | Re: BC breaking changes in PHP 8.1 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116175@lists.php.net to get a copy of this message | ||
Le dim. 26 sept. 2021 à 14:42, Jordi Boggiano <j.boggiano@seld.be> a écrit :
>
> > I'm surprised that is_resource() returns false for resource objects,
> > does anyone knows why it wouldn't return true in such case ?
> >
> > This is a very weird behavior, I'd expect it to return true, moreover
> > this is the most annoying detail of this BC break, in my opinion.
> >
> > I have lots of code using is_resource() but I usually don't bother
> > checking for type (maybe I'm doing it wrong). But I'd also expect
> > get_resource_type() to be deprecated somehow and return
> > backward-compatible values for converted resources to objects.
>
> Right, having is_resource return true for resourcey objects would have
> prevented all resource-related errors I ran into with php8.0 migration I
> believe. That'd be a welcome improvement/fix for 8.1.
>
I'm not sure about this one: is_resource($foo) ? get_resource_type() is
pretty common. Also this would break some expectations with gettype($foo)
Nicolas
>