Bug #18309

Change elderly while(list()=each()) to foreach calls in t3lib_tstemplate

Added by Franz Holzinger over 13 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2008-02-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

0007669.patch (9.58 KB) 0007669.patch Administrator Admin, 2008-02-26 14:31

Related issues

Related to TYPO3 Core - Bug #18312: Constants are not correctly substituted on some PHP5 distributionsClosedOliver Hader2008-02-26

Actions
Related to TYPO3 Core - Bug #21208: TypoScript FORM object does not render correctly anymoreClosedKasper Skaarhoj2009-10-08

Actions
#1

Updated by Franz Holzinger about 13 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.

#2

Updated by Benni Mack almost 13 years ago

Hey Franz seems to be unrelated to this issue (different file). right?

#3

Updated by Franz Holzinger almost 13 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.

Also available in: Atom PDF