[TYPO3-core] RFC: Bug #7669: Change elderly while(list()=each()) to foreach calls in t3lib_tstemplate

Michael Stucki michael at typo3.org
Sun Mar 2 00:48:18 CET 2008


Hi Olly,

> Problem:
> There are many old while(list()=each()) calls in t3lib_tstemplate. Some
> of them are buggy becaus the internal array pointer has to be resetted
> then walking through an array by each().
> One current side-problem is that in some PHP5 versions TypoScript
> constants are not substituted correctly - due to a missing reset($array).
> 
> Solution:
> Change these iterations to use foreach() and clean up the whole class a
> bit.
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=7669

You may be aware of it, but just to be sure: list/each is working on the
array itself while foreach will create a copy of the array. So this will
consume more memory unless you use a reference for the value. However, it
seems you have only used them a few times.

So did you take care of this already, or were the references added randomly?

- michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list