Bug #18309
closedChange elderly while(list()=each()) to foreach calls in t3lib_tstemplate
0%
Description
In some PHP5 versions the explode functions does not reset the array. A following while, list and each combination will not do anything.
class.t3lib_tstemplate.php
if (strstr($all,'{$')) {
$findConst = explode('{$',$all);
$theConstList=Array();
next($findConst);
while(list(,$constVal)=each($findConst)) {
So replace this by a foreach instead of the while
or insert the
reset ($findConst);
(issue imported from #M7669)
Files
Updated by Franz Holzinger over 16 years ago
Bug is still present in TYPO3 4.2 RC1:
class.t3lib_fe.php line 3229
$headerArray = explode('|', $this->config['config']['additionalHeaders']);
while(list(,$headLine)=each($headerArray)) {
No reset of the array has been done here.
Updated by Benni Mack over 16 years ago
Hey Franz seems to be unrelated to this issue (different file). right?
Updated by Franz Holzinger over 16 years ago
Yes, there are probably many PHP files which could not work under some PHP version.
I have a serious problem with t3lib_div::trimExplode:
See t3lib_div:
Unfortunately t3lib_div:;:trimExplode does not make a reset any more in TYPO3 4.2.1. This is bad, because a following list(..) -while will not be executed. The PHP explode does a reset.