Re: [SMARTY-DEV] foreach on iterator
[email protected] (boots)
| Newsgroups | php.smarty.dev |
|---|---|
| Message-ID | <[email protected]> |
--- Sean Coates <[email protected]> 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