Fixed #11512: Performance improvement: replace while(list()...) by foreach in the...
authorRupert Germann <rupi@gmx.li>
Wed, 5 Aug 2009 11:24:34 +0000 (11:24 +0000)
committerRupert Germann <rupi@gmx.li>
Wed, 5 Aug 2009 11:24:34 +0000 (11:24 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5764 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_page.php
t3lib/class.t3lib_tsparser.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_menu.php
typo3/sysext/cms/tslib/class.tslib_pagegen.php
typo3/sysext/cms/tslib/class.tslib_pibase.php

index cb8eb99..92d4deb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
 
        * Fixed bug #11539: t3ver_stage will not be resetted when t3ver_stage was >0 before (thanks to Fabrizio Branca)
        * Fixed #11430: Performance improvement: use $GLOBALS['EXEC_TIME'] instead of time() where it makes sense (Thanks to Niels Pardon)
+       * Fixed #11512: Performance improvement: replace while(list()...) by foreach in the TYPO3 core (part 1)
 
 2009-08-04  Michael Stucki  <michael@typo3.org>
 
index 51e78f7..fd7f0bf 100644 (file)
@@ -588,8 +588,7 @@ class t3lib_pageSelect {
                $MPA = array();
                if ($MP)        {
                        $MPA = explode(',',$MP);
-                       reset($MPA);
-                       while(list($MPAk) = each($MPA)) {
+                       foreach ($MPA as $MPAk => $v) {
                                $MPA[$MPAk] = explode('-', $MPA[$MPAk]);
                        }
                }
index 26a9837..8e4945c 100644 (file)
@@ -519,8 +519,7 @@ class t3lib_TSparser {
                if (strstr($string,$splitStr))  {
                        $newString='';
                        $allParts = explode($splitStr,chr(10).$string.chr(10)); // adds line break char before/after
-                       reset($allParts);
-                       while(list($c,$v)=each($allParts))      {
+                       foreach ($allParts as $c => $v) {
                                if (!$c)        {        // first goes through
                                        $newString.=$v;
                                } elseif (preg_match('/\r?\n\s*$/',$allParts[$c-1]))    {       // There must be a line-break char before.
@@ -576,8 +575,7 @@ class t3lib_TSparser {
         * @return      array           Same array but where the values has been parsed for include-commands
         */
        function checkIncludeLines_array($array)        {
-               reset($array);
-               while(list($k)=each($array))    {
+               foreach ($array as $k => $v) {
                        $array[$k]=t3lib_TSparser::checkIncludeLines($array[$k]);
                }
                return $array;
index 217247d..a649e50 100644 (file)
@@ -874,7 +874,7 @@ class tslib_cObj {
                                $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
                                if (!$capSplit) {$capSplit=chr(10);}
                                $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
-                               while (list($ca_key, $ca_val) = each($captionArray))    {
+                               foreach ($captionArray as $ca_key => $ca_val) {
                                        $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
                                }
                        }
@@ -1366,16 +1366,14 @@ class tslib_cObj {
                if ($conf['tables'] && $conf['source']) {
                        $allowedTables = $conf['tables'];
                        if (is_array($conf['conf.']))   {
-                               reset($conf['conf.']);
-                               while(list($k)=each($conf['conf.']))    {
+                               foreach ($conf['conf.'] as $k => $v) {
                                        if (substr($k,-1)!='.')         $allowedTables.=','.$k;
                                }
                        }
 
                        $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
                        $loadDB->start($conf['source'], $allowedTables);
-                       reset($loadDB->tableArray);
-                       while(list($table,)=each($loadDB->tableArray))  {
+                       foreach ($loadDB->tableArray as $table => $v) {
                                if (is_array($GLOBALS['TCA'][$table]))  {
                                        $loadDB->additionalWhere[$table]=$this->enableFields($table);
                                }
@@ -1389,8 +1387,7 @@ class tslib_cObj {
                        $cObj->setParent($this->data,$this->currentRecord);
                        $this->currentRecordNumber=0;
                        $this->currentRecordTotal = count($loadDB->itemArray);
-                       reset($loadDB->itemArray);
-                       while(list(,$val)=each($loadDB->itemArray))     {
+                       foreach ($loadDB->itemArray as $val) {
                                $row = $data[$val['table']][$val['id']];
 
                                        // Versioning preview:
@@ -1537,8 +1534,7 @@ class tslib_cObj {
                                'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.'])
                        );
                        $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1);
-                       reset($gapData);
-                       while(list(,$val)=each($gapData))       {
+                       foreach ($gapData as $val) {
                                $totalGapWidth+=intval($val['gapWidth']);
                        }
 
@@ -1654,8 +1650,7 @@ class tslib_cObj {
                } else {
                        array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register);
                        if (is_array($conf))    {
-                               reset($conf);
-                               while(list($theKey,$theValue)=each($conf))      {
+                               foreach ($conf as $theKey => $theValue) {
                                        if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)]))        {               // Only if 1) the property is set but not the value itself, 2) the value and/or any property
                                                if (strstr($theKey,'.'))        {
                                                        $theKey = substr($theKey,0,-1);
@@ -1716,9 +1711,8 @@ class tslib_cObj {
                                                list($temp[2]) = explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']);
                                                        // If value Array is set, then implode those values.
                                                if (is_array($dAA['valueArray.'])) {
-                                                       reset($dAA['valueArray.']);
                                                        $temp_accum = array();
-                                                       while (list($dAKey_vA,$dAA_vA) = each($dAA['valueArray.']))     {
+                                                       foreach ($dAA['valueArray.'] as $dAKey_vA => $dAA_vA) {
                                                                if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA))      {
                                                                        $temp_vA=array();
                                                                        list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']);
@@ -2155,8 +2149,7 @@ class tslib_cObj {
 
                        // hidden fields:
                if (is_array($conf['hiddenFields.']))   {
-                       reset($conf['hiddenFields.']);
-                       while (list($hF_key,$hF_conf) = each($conf['hiddenFields.']))   {
+                       foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) {
                                if (substr($hF_key,-1)!='.')    {
                                        $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields');
                                        if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient',$hF_key)) {
@@ -2222,9 +2215,9 @@ class tslib_cObj {
                                $temp_theStartId=t3lib_div::_GP('stype');
                                $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId);
                                        // The page MUST have a rootline with the Level0-page of the current site inside!!
-                               while(list(,$val)=each($rootLine))      {
+                               foreach ($rootLine as $val) {
                                        if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid'])     {
-                                               $theStartId=$temp_theStartId;
+                                               $theStartId = $temp_theStartId;
                                        }
                                }
                        } else if (t3lib_div::_GP('stype'))     {
@@ -2239,10 +2232,9 @@ class tslib_cObj {
                                                ksort($altRootLine);
                                                if (count($altRootLine))        {
                                                                // check if the rootline has the real Level0 in it!!
-                                                       reset($altRootLine);
                                                        $hitRoot=0;
                                                        $theNewRoot=array();
-                                                       while(list(,$val)=each($altRootLine))   {
+                                                       foreach ($altRootLine as $val) {
                                                                if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
                                                                        $hitRoot=1;
                                                                        $theNewRoot[]=$val;
@@ -2444,8 +2436,7 @@ class tslib_cObj {
                        if ($conf['nonCachedSubst'])    {               // NON-CACHED:
                                        // Getting marks
                                if (is_array($conf['marks.']))  {
-                                       reset($conf['marks.']);
-                                       while(list($theKey,$theValue)=each($conf['marks.']))    {
+                                       foreach ($conf['marks.'] as $theKey => $theValue) {
                                                if (!strstr($theKey,'.'))       {
                                                        $content = str_replace(
                                                                $PRE.$theKey.$POST,
@@ -2457,8 +2448,7 @@ class tslib_cObj {
 
                                        // Getting subparts.
                                if (is_array($conf['subparts.']))       {
-                                       reset($conf['subparts.']);
-                                       while(list($theKey,$theValue)=each($conf['subparts.'])) {
+                                       foreach ($conf['subparts.'] as $theKey => $theValue) {
                                                if (!strstr($theKey,'.'))       {
                                                        $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
                                                        if ($subpart)   {
@@ -2475,8 +2465,7 @@ class tslib_cObj {
                                }
                                        // Getting subpart wraps
                                if (is_array($conf['wraps.']))  {
-                                       reset($conf['wraps.']);
-                                       while(list($theKey,$theValue)=each($conf['wraps.']))    {
+                                       foreach ($conf['wraps.'] as $theKey => $theValue) {
                                                if (!strstr($theKey,'.'))       {
                                                        $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
                                                        if ($subpart)   {
@@ -2494,8 +2483,7 @@ class tslib_cObj {
                        } else {        // CACHED
                                        // Getting subparts.
                                if (is_array($conf['subparts.']))       {
-                                       reset($conf['subparts.']);
-                                       while(list($theKey,$theValue)=each($conf['subparts.'])) {
+                                       foreach ($conf['subparts.'] as $theKey => $theValue) {
                                                if (!strstr($theKey,'.'))       {
                                                        $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
                                                        if ($subpart)   {
@@ -2508,8 +2496,7 @@ class tslib_cObj {
                                }
                                        // Getting marks
                                if (is_array($conf['marks.']))  {
-                                       reset($conf['marks.']);
-                                       while(list($theKey,$theValue)=each($conf['marks.']))    {
+                                       foreach ($conf['marks.'] as $theKey => $theValue) {
                                                if (!strstr($theKey,'.'))       {
                                                        $marks[$theKey]['name'] = $theValue;
                                                        $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
@@ -2518,8 +2505,7 @@ class tslib_cObj {
                                }
                                        // Getting subpart wraps
                                if (is_array($conf['wraps.']))  {
-                                       reset($conf['wraps.']);
-                                       while(list($theKey,$theValue)=each($conf['wraps.']))    {
+                                       foreach ($conf['wraps.'] as $theKey => $theValue) {
                                                if (!strstr($theKey,'.'))       {
                                                        $wraps[$theKey]['name'] = $theValue;
                                                        $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
@@ -2528,8 +2514,7 @@ class tslib_cObj {
                                }
                                        // Getting subparts
                                $subpartArray =array();
-                               reset($subparts);
-                               while(list($theKey,$theValue)=each($subparts))  {
+                               foreach ($subparts as $theKey => $theValue) {
                                                // Set current with the content of the subpart...
                                        $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey];
                                                // Get subpart cObject and substitute it!
@@ -2539,14 +2524,12 @@ class tslib_cObj {
 
                                        // Getting marks
                                $markerArray =array();
-                               reset($marks);
-                               while(list($theKey,$theValue)=each($marks))     {
+                               foreach ($marks as $theKey => $theValue) {
                                        $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
                                }
                                        // Getting wraps
                                $subpartWraps =array();
-                               reset($wraps);
-                               while(list($theKey,$theValue)=each($wraps))     {
+                               foreach ($wraps as $theKey => $theValue) {
                                        $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
                                }
 
@@ -2598,7 +2581,7 @@ class tslib_cObj {
 
                                        // fetching params
                                $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.']));
-                               while(list(,$l)=each($lines))   {
+                               foreach ($lines as $l) {
                                        $parts = explode('=', $l);
                                        $parameter = strtolower(trim($parts[0]));
                                        $value = trim($parts[1]);
@@ -3139,20 +3122,17 @@ class tslib_cObj {
                                $storeArr=array();
 
                                        // Finding subparts and substituting them with the subpart as a marker
-                               reset($sPkeys);
-                               while(list(,$sPK)=each($sPkeys))        {
+                               foreach ($sPkeys as $sPK) {
                                        $content =$this->substituteSubpart($content,$sPK,$sPK);
                                }
 
                                        // Finding subparts and wrapping them with markers
-                               reset($wPkeys);
-                               while(list(,$wPK)=each($wPkeys))        {
+                               foreach ($wPkeys as $wPK) {
                                        $content =$this->substituteSubpart($content,$wPK,array($wPK,$wPK));
                                }
 
                                        // traverse keys and quote them for reg ex.
-                               reset($aKeys);
-                               while(list($tK,$tV)=each($aKeys))       {
+                               foreach ($aKeys as $tK => $tV) {
                                        $aKeys[$tK] = preg_quote($tV, '/');
                                }
                                $regex = '/' . implode('|', $aKeys) . '/';
@@ -3181,10 +3161,9 @@ class tslib_cObj {
                $valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
 
                $wSCA_reg=array();
-               reset($storeArr['k']);
                $content = '';
-                       // traversin the keyList array and merging the static and dynamic content
-               while(list($n,$keyN)=each($storeArr['k']))      {
+                       // traversing the keyList array and merging the static and dynamic content
+               foreach ($storeArr['k'] as $n => $keyN) {
                        $content.=$storeArr['c'][$n];
                        if (!is_array($valueArr[$keyN]))        {
                                $content.=$valueArr[$keyN];
@@ -3232,8 +3211,7 @@ class tslib_cObj {
         */
        public function substituteMarkerInObject(&$tree, array $markContentArray) {
                if (is_array ($tree)) {
-                       reset($tree);
-                       while(list($key, $value) = each($tree)) {
+                       foreach ($tree as $key => $value) {
                                $this->substituteMarkerInObject ($tree[$key], $markContentArray);
                        }
                } else {
@@ -3701,7 +3679,7 @@ class tslib_cObj {
                                        reset($items['sorting']);
                                        $fullPath = trim($data_arr[4]);
                                        $list_arr=Array();
-                                       while(list($key,)=each($items['sorting']))      {
+                                       foreach ($items['sorting'] as $key => $v) {
                                                $list_arr[]=  $fullPath ? $path.'/'.$items['files'][$key] : $items['files'][$key];
                                        }
                                        return implode(',',$list_arr);
@@ -4136,8 +4114,7 @@ class tslib_cObj {
                $mimetype='';
                if ($fI['extension'])   {
                        $mimeTypes = t3lib_div::trimExplode(',',$conf['mimeTypes'],1);
-                       reset($mimeTypes);
-                       while(list(,$v)=each($mimeTypes))       {
+                       foreach ($mimeTypes as $v) {
                                $parts = explode('=',$v,2);
                                if (strtolower($fI['extension']) == strtolower(trim($parts[0])))        {
                                        $mimetype = '&mimeType='.rawurlencode(trim($parts[1]));
@@ -4165,8 +4142,7 @@ class tslib_cObj {
        function calc($val)     {
                $parts= t3lib_div::splitCalc($val,'+-*/');
                $value=0;
-               reset($parts);
-               while(list(,$part)=each($parts))        {
+               foreach ($parts as $part) {
                        $theVal = $part[1];
                        $sign =  $part[0];
                        if ((string)intval($theVal)==(string)$theVal)   {
@@ -4193,7 +4169,7 @@ class tslib_cObj {
         */
        function calcIntExplode($delim, $string)        {
                $temp = explode($delim,$string);
-               while(list($key,$val)=each($temp))      {
+               foreach ($temp as $key => $val) {
                        $temp[$key]=intval(tslib_cObj::calc($val));
                }
                return $temp;
@@ -4291,8 +4267,7 @@ class tslib_cObj {
                        $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
                        $parts = $htmlParser->splitIntoBlock($tags,$theValue);
 
-                       reset($parts);
-                       while(list($k,$v)=each($parts)) {
+                       foreach ($parts as $k => $v) {
                                if ($k%2)       {       // font:
                                        $tagName=strtolower($htmlParser->getFirstTagName($v));
                                        $cfg=$conf['externalBlocks.'][$tagName.'.'];
@@ -4305,8 +4280,7 @@ class tslib_cObj {
                                }
                        }
 
-                       reset($parts);
-                       while(list($k,$v)=each($parts)) {
+                       foreach ($parts as $k => $v) {
                                if ($k%2)       {
                                        $tag=$htmlParser->getFirstTag($v);
                                        $tagName=strtolower($htmlParser->getFirstTagName($v));
@@ -4325,13 +4299,11 @@ class tslib_cObj {
                                                }
                                        } elseif($cfg['HTMLtableCells']) {
                                                $rowParts = $htmlParser->splitIntoBlock('tr',$parts[$k]);
-                                               reset($rowParts);
-                                               while(list($kk,$vv)=each($rowParts))    {
+                                               foreach ($rowParts as $kk => $vv) {
                                                        if ($kk%2)      {
                                                                $colParts = $htmlParser->splitIntoBlock('td,th',$vv);
-                                                               reset($colParts);
                                                                $cc=0;
-                                                               while(list($kkk,$vvv)=each($colParts))  {
+                                                               foreach ($colParts as $kkk => $vvv) {
                                                                        if ($kkk%2)     {
                                                                                $cc++;
                                                                                $tag=$htmlParser->getFirstTag($vvv);
@@ -4428,9 +4400,9 @@ class tslib_cObj {
 
                                        if (!is_array($currentTag))     {                       // These operations should only be performed on code outside the tags...
                                                        // Constants
-                                               if ($conf['constants'] && is_array($GLOBALS['TSFE']->tmpl->setup['constants.']))        {
-                                                       reset($GLOBALS['TSFE']->tmpl->setup['constants.']);
-                                                       while(list($key,$val)=each($GLOBALS['TSFE']->tmpl->setup['constants.']))        {
+                                               $tmpConstants = $GLOBALS['TSFE']->tmpl->setup['constants.'];
+                                               if ($conf['constants'] && is_array($tmpConstants)) {
+                                                       foreach ($tmpConstants as $key => $val) {
                                                                if (is_string($val))    {
                                                                        $data = str_replace('###'.$key.'###', $val, $data);
                                                                }
@@ -4440,8 +4412,7 @@ class tslib_cObj {
                                                if (is_array($conf['short.']))  {
                                                        $shortWords = $conf['short.'];
                                                        krsort($shortWords);
-                                                       reset($shortWords);
-                                                       while(list($key,$val)=each($shortWords))        {
+                                                       foreach ($shortWords as $key => $val) {
                                                                if (is_string($val))    {
                                                                        $data = str_replace($key, $val, $data);
                                                                }
@@ -4520,8 +4491,7 @@ class tslib_cObj {
                                                if ($currentTag[1])     {
                                                        $params=t3lib_div::get_tag_attributes($currentTag[1]);
                                                        if (is_array($params))  {
-                                                               reset($params);
-                                                               while(list($option,$val)=each($params)) {
+                                                               foreach ($params as $option => $val) {
                                                                        $this->parameters[strtolower($option)]=$val;
                                                                }
                                                        }
@@ -4598,7 +4568,7 @@ class tslib_cObj {
 
                if (!strcmp('',$theValue))      return '';
 
-               while(list($k,$l)=each($lParts))        {
+               foreach ($lParts as $k => $l) {
                        $sameBeginEnd=0;
                        $l=trim($l);
                        $attrib=array();
@@ -4629,8 +4599,7 @@ class tslib_cObj {
                        if ($uTagName)  {
                                        // Setting common attributes
                                if (is_array($conf['addAttributes.'][$uTagName.'.']))   {
-                                       reset($conf['addAttributes.'][$uTagName.'.']);
-                                       while(list($kk,$vv)=each($conf['addAttributes.'][$uTagName.'.']))       {
+                                       foreach ($conf['addAttributes.'][$uTagName.'.'] as $kk => $vv) {
                                                if (!is_array($vv))     {
                                                        if ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='blank')        {
                                                                if (!strcmp($attrib[$kk],''))   $attrib[$kk]=$vv;
@@ -4894,8 +4863,7 @@ class tslib_cObj {
                                                                                                // The image onto the background
                                                                                        $gifCreator->combineExec($tempScale['m_bgImg'],$tempFileInfo[3],$tempScale['m_mask'],$dest);
                                                                                                // Unlink the temp-images...
-                                                                                       reset($tempScale);
-                                                                                       while(list(,$file)=each($tempScale))    {
+                                                                                       foreach ($tempScale as $file) {
                                                                                                if (@is_file($file))    {
                                                                                                        unlink($file);
                                                                                                }
@@ -5003,7 +4971,7 @@ class tslib_cObj {
                        return $this->data[trim($field)];
                } else {
                        $sections = t3lib_div::trimExplode('//',$field,1);
-                       while (list(,$k)=each($sections)) {
+                       foreach ($sections as $k) {
                                if (strcmp($this->data[$k],'')) return $this->data[$k];
                        }
                }
@@ -5263,8 +5231,7 @@ class tslib_cObj {
                        $output = array();
                        foreach ($values as $value) {
                                        // Traverse the items-array...
-                               reset($TCA[$table]['columns'][$field]['config']['items']);
-                               while (list($key,$item)=each($TCA[$table]['columns'][$field]['config']['items'])) {
+                               foreach ($TCA[$table]['columns'][$field]['config']['items'] as $item) {
                                                // ... and return the first found label where the value was equal to $key
                                        if (!strcmp($item[1],trim($value))) {
                                                $output[] = $GLOBALS['TSFE']->sL($item[0]);
@@ -6115,8 +6082,7 @@ class tslib_cObj {
         */
        function keywords($content)     {
                $listArr = preg_split('/[,;' . chr(10) . ']/', $content);
-               reset($listArr);
-               while(list($k,$v)=each($listArr))       {
+               foreach ($listArr as $k => $v) {
                        $listArr[$k]=trim($v);
                }
                return implode(',',$listArr);
@@ -6288,7 +6254,7 @@ class tslib_cObj {
         */
        function clearTSProperties($TSArr,$propList)    {
                $list = explode(',',$propList);
-               while(list(,$prop)=each($list)) {
+               foreach ($list as $prop) {
                        $prop = trim($prop);
                        unset($TSArr[$prop]);
                        unset($TSArr[$prop.'.']);
@@ -6330,8 +6296,7 @@ class tslib_cObj {
         */
        function joinTSarrays($conf,$old_conf)  {
                if (is_array($old_conf))        {
-                       reset($old_conf);
-                       while(list($key,$val)=each($old_conf))  {
+                       foreach ($old_conf as $key => $val) {
                                if (is_array($val))     {
                                        $conf[$key] = $this->joinTSarrays($conf[$key],$val);
                                } else {
@@ -6361,8 +6326,7 @@ class tslib_cObj {
                if ($tmplObjNumber && $gifbuilderConf[$tmplObjNumber]=='TEXT')  {
                        $textArr = $this->linebreaks($text,$chars,$maxLines);
                        $angle = intval($gifbuilderConf[$tmplObjNumber.'.']['angle']);
-                       reset($textArr);
-                       while(list($c,$textChunk)=each($textArr))       {
+                       foreach ($textArr as $c => $textChunk) {
                                $index = $tmplObjNumber+1+($c*2);
                                        // Workarea
                                $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$index);
@@ -6411,9 +6375,9 @@ class tslib_cObj {
                $lines = explode(chr(10),$string);
                $lineArr=Array();
                $c=0;
-               while(list(,$paragraph)=each($lines))   {
+               foreach ($lines as $paragraph) {
                        $words = explode(' ',$paragraph);
-                       while(list(,$word)=each($words))        {
+                       foreach ($words as $word) {
                                if (strlen($lineArr[$c].$word)>$chars)  {
                                        $c++;
                                }
@@ -6441,12 +6405,10 @@ class tslib_cObj {
        function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList)     {
                $JSPart='';
                $updateValues=t3lib_div::trimExplode(',',$fieldList);
-               reset($updateValues);
-               while(list(,$fKey)=each($updateValues)) {
+               foreach ($updateValues as $fKey) {
                        $value = $dataArray[$fKey];
                        if (is_array($value))   {
-                               reset($value);
-                               while(list(,$Nvalue)=each($value))      {
+                               foreach ($value as $Nvalue) {
                                        $JSPart.="
        updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',".t3lib_div::quoteJSvalue($Nvalue, true).");";
                                }
@@ -6728,7 +6690,7 @@ class tslib_cObj {
                        // points to the field (integer) that holds the fe_group-id of the creator fe_user's first group
                if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'])   {
                        $values = t3lib_div::intExplode(',',$groupList);
-                       while(list(,$theGroupUid)=each($values))        {
+                       foreach ($values as $theGroupUid) {
                                if ($theGroupUid)       {$OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'].'='.$theGroupUid;}
                        }
                }
@@ -7039,13 +7001,12 @@ class tslib_cObj {
                        $searchFields = explode(',',$searchFieldList);
                        $kw = preg_split('/[ ,]/', $sw);
 
-                       while(list(,$val)=each($kw))    {
+                       foreach ($kw as $val) {
                                $val = trim($val);
                                $where_p = array();
                                if (strlen($val)>=2)    {
                                        $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val,$searchTable),$searchTable);
-                                       reset($searchFields);
-                                       while(list(,$field)=each($searchFields))        {
+                                       foreach ($searchFields as $field) {
                                                $where_p[] = $prefixTableName.$field.' LIKE \'%'.$val.'%\'';
                                        }
                                }
@@ -7464,8 +7425,7 @@ class tslib_frameset {
                $content = '';
                if (is_array($setup))   {
                        $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
-                       reset($sKeyArray);
-                       while(list(,$theKey)=each($sKeyArray))  {
+                       foreach ($sKeyArray as $theKey) {
                                $theValue=$setup[$theKey];
                                if (intval($theKey) && $conf=$setup[$theKey.'.'])       {
                                        switch($theValue)       {
index c1cc25b..584fe76 100644 (file)
@@ -708,8 +708,7 @@ class tslib_menu {
                                                        $prevnext_menu = $this->sys_page->getMenu($value_rec['pid'],'*',$altSortField);
                                                        $lastKey=0;
                                                        $nextActive=0;
-                                                       reset($prevnext_menu);
-                                                       while(list($k_b,$v_b)=each($prevnext_menu))     {
+                                                       foreach ($prevnext_menu as $k_b => $v_b) {
                                                                if ($nextActive)        {
                                                                        $recArr['next']=$v_b;
                                                                        $nextActive=0;
@@ -732,8 +731,7 @@ class tslib_menu {
                                                                $prevnextsection_menu = $this->sys_page->getMenu($recArr['index']['uid'],'*',$altSortField);
                                                                $lastKey=0;
                                                                $nextActive=0;
-                                                               reset($prevnextsection_menu);
-                                                               while(list($k_b,$v_b)=each($prevnextsection_menu))      {
+                                                               foreach ($prevnextsection_menu as $k_b => $v_b) {
                                                                        if ($nextActive)        {
                                                                                $sectionRec_temp = $this->sys_page->getMenu($v_b['uid'],'*',$altSortField);
                                                                                if (count($sectionRec_temp))    {
@@ -770,7 +768,7 @@ class tslib_menu {
 
                                                        $items = explode('|',$this->conf['special.']['items']);
                                                        $c=0;
-                                                       while(list($k_b,$v_b)=each($items))     {
+                                                       foreach ($items as $k_b => $v_b) {
                                                                $v_b=strtolower(trim($v_b));
                                                                if (intval($this->conf['special.'][$v_b.'.']['uid']))   {
                                                                        $recArr[$v_b] = $this->sys_page->getPage(intval($this->conf['special.'][$v_b.'.']['uid']));     // fetches the page in case of a hardcoded pid in template
@@ -780,9 +778,9 @@ class tslib_menu {
                                                                        if ($this->conf['special.'][$v_b.'.']['target'])        {
                                                                                $temp[$c]['target']=$this->conf['special.'][$v_b.'.']['target'];
                                                                        }
-                                                                       if (is_array($this->conf['special.'][$v_b.'.']['fields.']))     {
-                                                                               reset($this->conf['special.'][$v_b.'.']['fields.']);
-                                                                               while(list($fk,$val)=each($this->conf['special.'][$v_b.'.']['fields.']))        {
+                                                                       $tmpSpecialFields = $this->conf['special.'][$v_b.'.']['fields.'];
+                                                                       if (is_array($tmpSpecialFields)) {
+                                                                               foreach ($tmpSpecialFields as $fk => $val) {
                                                                                        $temp[$c][$fk]=$val;
                                                                                }
                                                                        }
@@ -1007,8 +1005,7 @@ class tslib_menu {
                        // IFSUB is true if there exist submenu items to the current item
                if ($this->mconf['IFSUB'])      {
                        $IFSUBinit = 0; // Flag: If $IFSUB is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {
+                       foreach ($NOconf as $key => $val) {
                                if ($this->isItemState('IFSUB',$key))   {
                                        if (!$IFSUBinit)        {       // if this is the first IFSUB element, we must generate IFSUB.
                                                $IFSUBconf = $this->tmpl->splitConfArray($this->mconf['IFSUB.'],$splitCount);
@@ -1027,8 +1024,7 @@ class tslib_menu {
                        // Prepare active settings, overriding normal settings
                if ($this->mconf['ACT'])        {
                        $ACTinit = 0;   // Flag: If $ACT is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {       // Find active
+                       foreach ($NOconf as $key => $val) {     // Find active
                                if ($this->isItemState('ACT',$key))     {
                                        if (!$ACTinit)  {       // if this is the first 'active', we must generate ACT.
                                                $ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'],$splitCount);
@@ -1049,8 +1045,7 @@ class tslib_menu {
                        // ACTIFSUB is true if there exist submenu items to the current item and the current item is active
                if ($this->mconf['ACTIFSUB'])   {
                        $ACTIFSUBinit = 0;      // Flag: If $ACTIFSUB is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {       // Find active
+                       foreach ($NOconf as $key => $val) {     // Find active
                                if ($this->isItemState('ACTIFSUB',$key))        {
                                        if (!$ACTIFSUBinit)     {       // if this is the first 'active', we must generate ACTIFSUB.
                                                $ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'],$splitCount);
@@ -1071,8 +1066,7 @@ class tslib_menu {
                        // CUR is true if the current page equals the item here!
                if ($this->mconf['CUR'])        {
                        $CURinit = 0;   // Flag: If $CUR is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {
+                       foreach ($NOconf as $key => $val) {
                                if ($this->isItemState('CUR',$key))     {
                                        if (!$CURinit)  {       // if this is the first 'current', we must generate CUR. Basically this control is just inherited from the other implementations as current would only exist one time and thats it (unless you use special-features of HMENU)
                                                $CURconf = $this->tmpl->splitConfArray($this->mconf['CUR.'],$splitCount);
@@ -1092,8 +1086,7 @@ class tslib_menu {
                        // CURIFSUB is true if there exist submenu items to the current item and the current page equals the item here!
                if ($this->mconf['CURIFSUB'])   {
                        $CURIFSUBinit = 0;      // Flag: If $CURIFSUB is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {
+                       foreach ($NOconf as $key => $val) {
                                if ($this->isItemState('CURIFSUB',$key))        {
                                        if (!$CURIFSUBinit)     {       // if this is the first 'current', we must generate CURIFSUB.
                                                $CURIFSUBconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUB.'],$splitCount);
@@ -1113,8 +1106,7 @@ class tslib_menu {
                        // Prepare active settings, overriding normal settings
                if ($this->mconf['USR'])        {
                        $USRinit = 0;   // Flag: If $USR is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {       // Find active
+                       foreach ($NOconf as $key => $val) {     // Find active
                                if ($this->isItemState('USR',$key))     {
                                        if (!$USRinit)  {       // if this is the first active, we must generate USR.
                                                $USRconf = $this->tmpl->splitConfArray($this->mconf['USR.'],$splitCount);
@@ -1134,8 +1126,7 @@ class tslib_menu {
                        // Prepare spacer settings, overriding normal settings
                if ($this->mconf['SPC'])        {
                        $SPCinit = 0;   // Flag: If $SPC is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {       // Find spacers
+                       foreach ($NOconf as $key => $val) {     // Find spacers
                                if ($this->isItemState('SPC',$key))     {
                                        if (!$SPCinit)  {       // if this is the first spacer, we must generate SPC.
                                                $SPCconf = $this->tmpl->splitConfArray($this->mconf['SPC.'],$splitCount);
@@ -1148,8 +1139,7 @@ class tslib_menu {
                        // Prepare Userdefined settings
                if ($this->mconf['USERDEF1'])   {
                        $USERDEF1init = 0;      // Flag: If $USERDEF1 is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {       // Find active
+                       foreach ($NOconf as $key => $val) {     // Find active
                                if ($this->isItemState('USERDEF1',$key))        {
                                        if (!$USERDEF1init)     {       // if this is the first active, we must generate USERDEF1.
                                                $USERDEF1conf = $this->tmpl->splitConfArray($this->mconf['USERDEF1.'],$splitCount);
@@ -1169,8 +1159,7 @@ class tslib_menu {
                        // Prepare Userdefined settings
                if ($this->mconf['USERDEF2'])   {
                        $USERDEF2init = 0;      // Flag: If $USERDEF2 is generated
-                       reset($NOconf);
-                       while (list($key,$val)=each($NOconf))   {       // Find active
+                       foreach ($NOconf as $key => $val) {     // Find active
                                if ($this->isItemState('USERDEF2',$key))        {
                                        if (!$USERDEF2init)     {       // if this is the first active, we must generate USERDEF2.
                                                $USERDEF2conf = $this->tmpl->splitConfArray($this->mconf['USERDEF2.'],$splitCount);
@@ -1276,7 +1265,7 @@ class tslib_menu {
                                $LD['target'] = '';
                        }
                }
-               
+
                        // out:
                $list = array();
                $list['HREF'] = strlen($LD['totalURL']) ? $LD['totalURL'] : $GLOBALS['TSFE']->baseUrl;  // Added this check: What it does is to enter the baseUrl (if set, which it should for "realurl" based sites) as URL if the calculated value is empty. The problem is that no link is generated with a blank URL and blank URLs might appear when the realurl encoding is used and a link to the frontpage is generated.
@@ -1694,8 +1683,7 @@ class tslib_tmenu extends tslib_menu {
                        $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix'=>$this->mconf['submenuObjSuffixes']),$this->WMmenuItems);
 
                        $this->extProc_init();
-                       reset($this->result);
-                       while (list($key,$val)=each($this->result))     {
+                       foreach ($this->result as $key => $val) {
                                $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
                                $GLOBALS['TSFE']->register['count_MENUOBJ']++;
 
@@ -2097,8 +2085,7 @@ class tslib_gmenu extends tslib_menu {
                $c=0;
                $maxFlag=0;
                $distributeAccu=array('H'=>0,'W'=>0);
-               reset($conf);
-               while (list($key,$val)=each($conf))     {
+               foreach ($conf as $key => $val) {
                        $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
                        $GLOBALS['TSFE']->register['count_MENUOBJ']++;
 
@@ -2106,8 +2093,7 @@ class tslib_gmenu extends tslib_menu {
                                $Lobjs = $this->mconf['removeObjectsOfDummy'];
                                if ($Lobjs)     {
                                        $Lobjs = t3lib_div::intExplode(',',$Lobjs);
-                                       reset($Lobjs);
-                                       while(list(,$remItem)=each($Lobjs))     {
+                                       foreach ($Lobjs as $remItem) {
                                                unset($val[$remItem]);
                                                unset($val[$remItem.'.']);
                                        }
@@ -2182,8 +2168,7 @@ class tslib_gmenu extends tslib_menu {
 
                                // displace
                                if ($Hobjs)     {
-                                       reset($Hobjs);
-                                       while(list(,$index)=each($Hobjs))       {
+                                       foreach ($Hobjs as $index) {
                                                if ($gifCreator->setup[$index] && $gifCreator->setup[$index.'.'])       {
                                                        $oldOffset = explode(',',$gifCreator->setup[$index.'.']['offset']);
                                                        $gifCreator->setup[$index.'.']['offset'] = implode(',',$gifCreator->applyOffset($oldOffset,Array(0,-$Hcounter)));
@@ -2192,8 +2177,7 @@ class tslib_gmenu extends tslib_menu {
                                }
 
                                if ($Wobjs)     {
-                                       reset($Wobjs);
-                                       while(list(,$index)=each($Wobjs))       {
+                                       foreach ($Wobjs as $index) {
                                                if ($gifCreator->setup[$index] && $gifCreator->setup[$index.'.'])       {
                                                        $oldOffset = explode(',',$gifCreator->setup[$index.'.']['offset']);
                                                        $gifCreator->setup[$index.'.']['offset'] = implode(',',$gifCreator->applyOffset($oldOffset,Array(-$Wcounter,0)));
@@ -2270,15 +2254,13 @@ class tslib_gmenu extends tslib_menu {
                $Wcounter = 0;
                $c=0;
                $maxFlag=0;
-               reset($conf);
-               while (list($key,$val)=each($conf))     {
+               foreach ($conf as $key => $val) {
                        // SAME CODE AS makeGifs()! BEGIN
                        if ($items==($c+1) && $minDim)  {
                                $Lobjs = $this->mconf['removeObjectsOfDummy'];
                                if ($Lobjs)     {
                                        $Lobjs = t3lib_div::intExplode(',',$Lobjs);
-                                       reset($Lobjs);
-                                       while(list(,$remItem)=each($Lobjs))     {
+                                       foreach ($Lobjs as $remItem) {
                                                unset($val[$remItem]);
                                                unset($val[$remItem.'.']);
                                        }
@@ -2603,9 +2585,8 @@ class tslib_imgmenu extends tslib_menu {
                                $lastOriginal = $gifObjCount;
 
                                        // Now we add graphical objects to the gifbuilder-setup
-                               reset($itemsConf);
                                $waArr = Array();
-                               while (list($key,$val)=each($itemsConf))        {
+                               foreach ($itemsConf as $key => $val) {
                                        if (is_array($val))     {
                                                $gifObjCount++;
                                                $waArr[$key]['free']=$gifObjCount;
@@ -2666,8 +2647,7 @@ class tslib_imgmenu extends tslib_menu {
                                                                if ($theValue=='IMAGE') {
                                                                        if ($theValArr['file']=='GIFBUILDER')   {
                                                                                $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['file.']);
-                                                                               reset($temp_sKeyArray);
-                                                                               while(list(,$temp_theKey)=each($temp_sKeyArray))        {
+                                                                               foreach ($temp_sKeyArray as $temp_theKey) {
                                                                                        if ($theValArr['mask.'][$temp_theKey]=='TEXT')  {
                                                                                                $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array();
                                                                                                $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']);
@@ -2677,8 +2657,7 @@ class tslib_imgmenu extends tslib_menu {
                                                                        }
                                                                        if ($theValArr['mask']=='GIFBUILDER')   {
                                                                                $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['mask.']);
-                                                                               reset($temp_sKeyArray);
-                                                                               while(list(,$temp_theKey)=each($temp_sKeyArray))        {
+                                                                               foreach ($temp_sKeyArray as $temp_theKey) {
                                                                                        if ($theValArr['mask.'][$temp_theKey]=='TEXT')  {
                                                                                                $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array();
                                                                                                $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']);
@@ -2712,9 +2691,8 @@ class tslib_imgmenu extends tslib_menu {
                                        // calculations
 
                                $sum=Array(0,0,0,0);
-                               reset($waArr);
-                               while (list($key,$val)=each($waArr))    {
-                                       if ($dConf[$key] =$itemsConf[$key]['distrib'])  {
+                               foreach ($waArr as $key => $val) {
+                                       if (($dConf[$key] = $itemsConf[$key]['distrib'])) {
                                                $textBB = $gifCreator->objBB[$val['textNum']];
                                                $dConf[$key] = str_replace('textX',$textBB[0],$dConf[$key]);
                                                $dConf[$key] = str_replace('textY',$textBB[1],$dConf[$key]);
@@ -2722,8 +2700,7 @@ class tslib_imgmenu extends tslib_menu {
                                        }
                                }
                                $workArea = t3lib_div::intExplode(',',$gifCreator->calcOffset($this->mconf['dWorkArea']));
-                               reset($waArr);
-                               while (list($key,$val)=each($waArr))    {
+                               foreach ($waArr as $key => $val) {
                                        $index = $val['free'];
                                        $gifCreator->setup[$index] = 'WORKAREA';
                                        $workArea[2] = $dConf[$key][2] ? $dConf[$key][2] : $dConf[$key][0];
index 074f0fc..b750d79 100644 (file)
@@ -102,12 +102,10 @@ class TSpagegen {
                }
                if ($GLOBALS['TSFE']->config['config']['MP_defaults'])  {
                        $temp_parts = t3lib_div::trimExplode('|',$GLOBALS['TSFE']->config['config']['MP_defaults'],1);
-                       reset($temp_parts);
-                       while(list(,$temp_p)=each($temp_parts)) {
+                       foreach ($temp_parts as $temp_p) {
                                list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);
                                $temp_ids=t3lib_div::intExplode(',',$temp_idP);
-                               reset($temp_ids);
-                               while(list(,$temp_id)=each($temp_ids))  {
+                               foreach ($temp_ids as $temp_id) {
                                        $GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp;
                                }
                        }
@@ -169,8 +167,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                        $noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);
 
                        $space = ($standAlone) ? '[[:space:]]' : '';
-                       reset($GLOBALS['TSFE']->sWordList);
-                       while (list($key,$val) = each($GLOBALS['TSFE']->sWordList))     {
+                       foreach ($GLOBALS['TSFE']->sWordList as $val) {
                                if (trim($val)) {
                                        if (!$noMixedCase) {
                                                $GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';
@@ -272,8 +269,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}
                if (is_array($GLOBALS['TSFE']->tmpl->setup['includeLibs.']))    {$incLibs+=$GLOBALS['TSFE']->tmpl->setup['includeLibs.'];}      // toplevel 'includeLibs' is added to the PAGE.includeLibs. In that way, PAGE-libs get first priority, because if the key already exist, it's not altered. (Due to investigation by me)
                if (count($incLibs))    {
-                       reset($incLibs);
-                       while(list(,$theLib)=each($incLibs))    {
+                       foreach ($incLibs as $theLib) {
                                if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib))        {
                                        $incFilesArray[] = $incFile;
                                }
@@ -676,8 +672,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
 
                $conf=$GLOBALS['TSFE']->pSetup['meta.'];
                if (is_array($conf))    {
-                       reset($conf);
-                       while(list($theKey,$theValue)=each($conf))      {
+                       foreach ($conf as $theKey => $theValue) {
                                if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)]))        {               // Only if 1) the property is set but not the value itself, 2) the value and/or any property
                                        if (strstr($theKey,'.'))        {
                                                $theKey = substr($theKey,0,-1);
index 82f80cc..b161ad8 100644 (file)
@@ -640,8 +640,7 @@ class tslib_pibase {
         */
        function pi_list_modeSelector($items=array(),$tableParams='')   {
                $cells=array();
-               reset($items);
-               while(list($k,$v)=each($items)) {
+               foreach ($items as $k => $v) {
                        $cells[]='
                                        <td'.($this->piVars['mode']==$k?$this->pi_classParam('modeSelector-SCell'):'').'><p>'.
                                $this->pi_linkTP_keepPIvars(htmlspecialchars($v),array('mode'=>$k),$this->pi_isOnlyFields($this->pi_isOnlyFields)).
@@ -981,9 +980,9 @@ class tslib_pibase {
                        }
 
                                // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!):
-                       if (is_array($this->conf['_LOCAL_LANG.']))      {
-                               reset($this->conf['_LOCAL_LANG.']);
-                               while(list($k,$lA)=each($this->conf['_LOCAL_LANG.']))   {
+                       $confLL = $this->conf['_LOCAL_LANG.'];
+                       if (is_array($confLL)) {
+                               foreach ($confLL as $k => $lA) {
                                        if (is_array($lA))      {
                                                $k = substr($k,0,-1);
                                                foreach($lA as $llK => $llV)    {
@@ -1196,7 +1195,7 @@ class tslib_pibase {
        function pi_prependFieldsWithTable($table,$fieldList)   {
                $list=t3lib_div::trimExplode(',',$fieldList,1);
                $return=array();
-               while(list(,$listItem)=each($list))     {
+               foreach ($list as $listItem) {
                        $return[]=$table.'.'.$listItem;
                }
                return implode(',',$return);
@@ -1262,7 +1261,7 @@ class tslib_pibase {
 
                $fList = t3lib_div::trimExplode(',',$fList,1);
                $tempPiVars = $this->piVars;
-               while(list(,$k)=each($fList))   {
+               foreach ($fList as $k) {
                        if (!t3lib_div::testInt($tempPiVars[$k]) || $tempPiVars[$k]<$lowerThan)         unset($tempPiVars[$k]);
                }
                if (!count($tempPiVars))        return 1;
@@ -1279,8 +1278,7 @@ class tslib_pibase {
         */
        function pi_autoCache($inArray) {
                if (is_array($inArray)) {
-                       reset($inArray);
-                       while(list($fN,$fV)=each($inArray))     {
+                       foreach ($inArray as $fN => $fV) {
                                if (!strcmp($inArray[$fN],''))  {
                                        unset($inArray[$fN]);
                                } elseif (is_array($this->pi_autoCacheFields[$fN]))     {