Re: [RFC - discussion] __toArray()

From: Date: Tue, 04 Feb 2020 13:35:52 +0000
Subject: Re: [RFC - discussion] __toArray()
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-108376@lists.php.net to get a copy of this message
On Tue, Feb 4, 2020 at 2:10 PM Marco Pivetta <ocramius@gmail.com> wrote: > Linking (again) previous discussions: > https://externals.io/message/98539#98539 > > __toArray as a magic function call when > (array) cast happen is a bad > idea: it is a BC break, and it removes one of the very few interactions > (with objects) that didn't cause any side-effects ( > https://externals.io/message/98539#98545, > https://externals.io/message/98539#98567) > I think we can't classify it as BC break, because no existing code implements __toArray at the moment, and hence it will not fail when this feature is introduced and code gets upgraded to newer versions. Its correct that this removes the last simple way to get access to all properties on an object, although we can potentially remedy this with a function (which makes a lot of sense). > > Greets, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > > On Tue, Feb 4, 2020 at 2:03 PM Steven Wade <stevenwadejr@gmail.com> wrote: > > > Hi all, > > > > I’d like to officially open my __toArray() RFC < > > https://wiki.php.net/rfc/to-array> up to discussion. > > I’ve delayed > > changing the status until I had more time to respond to the discussion, > but > > since it’s been brought up again > > <https://externals.io/message/108351>, > I > > figured now is the best time. > > > > https://wiki.php.net/rfc/to-array > > <https://wiki.php.net/rfc/to-array> > > > > Cheers, > > > > Steven Wade >

« previous php.internals (#108376) next »