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

From: Date: Thu, 25 Sep 2014 09:50:28 +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 14  Groups: php.internals 
Request: Send a blank email to internals+get-77618@lists.php.net to get a copy of this message
On Wed, Sep 24, 2014 at 9:44 PM, Andrea Faulds <ajf@ajf.me> wrote: > > 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(). Is it really necessary? I could imagine a transition with 5.7 for that, similar to gmp. Cheers, -- Pierre @pierrejoye | http://www.libgd.org

« previous php.internals (#77618) next »