Re: [RFC] Fix "foreach" behavior

From: Date: Sat, 31 Jan 2015 05:10:50 +0000
Subject: Re: [RFC] Fix "foreach" behavior
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-81468@lists.php.net to get a copy of this message
Hi, Nikita got an idea about stopping changing of array/object internal pointers even in forech by reference. I've added an additional RFC section: https://wiki.php.net/rfc/php7_foreach#additional_behavoir_change Trivial implementation on top of the main patch: https://gist.github.com/dstogov/63b269207ba0aed8b776 and an additional proposed voting question. Also, the implementation now must be almost complete. Thanks. Dmitry. On Fri, Jan 30, 2015 at 10:23 AM, Dmitry Stogov <dmitry@zend.com> wrote: > Hi, > > I'd like to start discussion about fixing inconsistent "foreach" statement > behavior. > The implementation is almost done. It not only fixes inconsistencies in a > defined by RFC way but also improves performance in most usual cases, > because now foreach by value over array doesn't require array duplication. > > https://wiki.php.net/rfc/php7_foreach > > https://github.com/php/php-src/pull/1034 > > I'm going to continue work on implementation improvement and may be fixing > related behavior of some internal functions when they used on array > iterated by foreach by reference (e.g. array_unshift()). However, the > conceptual behavior defined in RFC is not going to be changed anymore. > > Thanks. Dmitry. > >

« previous php.internals (#81468) next »