Re: Invokation on __toString() for object used as array key

From: Date: Wed, 24 Sep 2014 19:44:10 +0000
Subject: Re: Invokation on __toString() for object used as array key
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-77587@lists.php.net to get a copy of this message
On 24 Sep 2014, at 20:39, Stas Malyshev <smalyshev@sugarcrm.com> wrote: >> I also wonder why we still need them. Doing what has been done with gmp >> for all resources would be a good move for 7. > > In general, I think we do not - IIRC everything resources do objects can > do better now, and the problems that prevented one from using objects > instead of resources are long gone. > > However, is_resource() checks and lots of third-party extensions using > resources may be a bit of a problem for eliminating them. I already figured out how to solve the is_resource() issue. Create an almost-useless, uninstantiatable class called Resource which any new resource-replacing classes inherit from. Then, make is_resource() check whether something is an instance of that class. Of course, 3rd-party extensions are still a problem, but this should mostly fix it. Of course, gettype() is still going to return “object” not “resource”, but I suspect people are more likely to use is_resource(). -- Andrea Faulds http://ajf.me/

« previous php.internals (#77587) next »