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

From: Date: Wed, 24 Sep 2014 08:41:36 +0000
Subject: Re: Invokation on __toString() for object used as array key
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-77573@lists.php.net to get a copy of this message
On Sep 24, 2014 10:19 AM, "Michael Wallner" <mike@php.net> wrote: > > On 24/09/14 08:30, Stas Malyshev wrote: > > Hi! > > > >> Well, then let's remove this restriction from resources, too. > > > > Not sure what use would it be for resources - resource IDs are not > > controlled by user code and for all intents and purposes are opaque > > numbers, which also do not have to be unique over the life of the > > script. What use would it be to index by those, especially by implicit > > convert? I don't think right now we have implicit convert of resources > > to ints anywhere, like we do have with __toString. > > > > There's currently no way to associate any data with a resource, except > by its ID. > > $context[(int) $resource] = ...; > > IIRC resources *were* implicitely converted to integers up until a > specific version, I'll have to look that up in history, though. > 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.

« previous php.internals (#77573) next »