Re: [SMARTY-DEV] foreach on iterator

From: Date: Sat, 19 Mar 2005 20:32:44 +0000
Subject: Re: [SMARTY-DEV] foreach on iterator
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2670@lists.php.net to get a copy of this message
--- Sean Coates <sean@caedmon.net> wrote: > Please read the archives. > http://news.php.net/php.smarty.dev/2608 > > Robin Ericsson wrote: > > I have a class which it using SPL and implements Iterator. > > [..snip..] > > {foreach from=$iterator item=key) generates the following code: > > > > <?php if (count($_from = > > (array)$this->_tpl_vars['revisionIterator'])): > > foreach ($_from as $this->_tpl_vars['revision']): > > endforeach; endif; unset($_from); ?> > > [..snip..] > > ...casts the object into an array and therefore break my class. I don't think monte or messju will object to me posting this, so... To prevent another long thread on this, I'll just quickly say that recent discussion suggests that the condition that prevents this from currently working will be removed but explicit support for iterators is unlikely (at this time). In other words, the functionality won't be prohibited but it won't be officially supported either. I think monte or messju will likely commit the change before the next release or shortly afterwards. It appears that messju's final proposal will be used so if you are anxious and can't wait, go ahead and apply the patch yourself. xo boots

« previous php.smarty.dev (#2670) next »