Index: t3lib/class.t3lib_admin.php =================================================================== --- t3lib/class.t3lib_admin.php (Revision 6977) +++ t3lib/class.t3lib_admin.php (Arbeitskopie) @@ -314,10 +314,9 @@ */ function lostRecords($pid_list) { global $TCA; - reset($TCA); $this->lostPagesList=''; if ($pid_list) { - while (list($table)=each($TCA)) { + foreach($TCA as $table => $tableConf) { t3lib_div::loadTCA($table); $pid_list_tmp = $pid_list; @@ -373,11 +372,10 @@ */ function countRecords($pid_list) { global $TCA; - reset($TCA); $list=Array(); $list_n=Array(); if ($pid_list) { - while (list($table)=each($TCA)) { + foreach($TCA as $table => $tableConf) { t3lib_div::loadTCA($table); $pid_list_tmp = $pid_list; @@ -408,13 +406,11 @@ */ function getGroupFields($mode) { global $TCA; - reset ($TCA); $result = Array(); - while (list($table)=each($TCA)) { + foreach($TCA as $table => $tableConf) { t3lib_div::loadTCA($table); $cols = $TCA[$table]['columns']; - reset ($cols); - while (list($field,$config)=each($cols)) { + foreach($cols as $field => $config) { if ($config['config']['type']=='group') { if ( ((!$mode||$mode=='file') && $config['config']['internal_type']=='file') || @@ -442,13 +438,11 @@ */ function getFileFields($uploadfolder) { global $TCA; - reset ($TCA); $result = Array(); - while (list($table)=each($TCA)) { + foreach($TCA as $table => $tableConf) { t3lib_div::loadTCA($table); $cols = $TCA[$table]['columns']; - reset ($cols); - while (list($field,$config)=each($cols)) { + foreach($cols as $field => $config) { if ($config['config']['type']=='group' && $config['config']['internal_type']=='file' && $config['config']['uploadfolder']==$uploadfolder) { $result[]=Array($table,$field); } @@ -467,11 +461,10 @@ global $TCA; $result = Array(); reset ($TCA); - while (list($table)=each($TCA)) { + foreach($TCA as $table => $tableConf) { t3lib_div::loadTCA($table); $cols = $TCA[$table]['columns']; - reset ($cols); - while (list($field,$config)=each($cols)) { + foreach($cols as $field => $config) { if ($config['config']['type']=='group' && $config['config']['internal_type']=='db') { if (trim($config['config']['allowed'])=='*' || strstr($config['config']['allowed'],$theSearchTable)) { $result[]=Array($table,$field); @@ -494,8 +487,7 @@ function selectNonEmptyRecordsWithFkeys($fkey_arrays) { global $TCA; if (is_array($fkey_arrays)) { - reset($fkey_arrays); - while (list($table,$field_list)=each($fkey_arrays)) { + foreach($fkey_arrays as $table => $field_list) { if ($TCA[$table] && trim($field_list)) { t3lib_div::loadTCA($table); $fieldArr = explode(',',$field_list); @@ -506,7 +498,7 @@ list(,$field)=each($fieldArr); $cl_fl = ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'R') ? $field.'!=0' : $field.'!=\'\''; - while (list(,$field)=each($fieldArr)) { + foreach($fieldArr as $field) { $cl_fl .= ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'R') ? ' OR '.$field.'!=0' : ' OR '.$field.'!=\'\''; } @@ -518,8 +510,7 @@ $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,'.$field_list, $table, $cl_fl); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) { - reset($fieldArr); - while (list(,$field)=each($fieldArr)) { + foreach($fieldArr as $field) { if (trim($row[$field])) { $fieldConf = $TCA[$table]['columns'][$field]['config']; if ($fieldConf['type']=='group') { @@ -529,8 +520,7 @@ $tempArr=array(); $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup'); $dbAnalysis->start('','files',$fieldConf['MM'],$row['uid']); - reset($dbAnalysis->itemArray); - while (list($somekey,$someval)=each($dbAnalysis->itemArray)) { + foreach ($dbAnalysis->itemArray as $somekey => $someval) { if ($someval['id']) { $tempArr[]=$someval['id']; } @@ -538,8 +528,7 @@ } else { $tempArr = explode(',',trim($row[$field])); } - reset($tempArr); - while (list(,$file)=each($tempArr)) { + foreach($tempArr as $file) { $file = trim($file); if ($file) { $this->checkFileRefs[$fieldConf['uploadfolder']][$file]+=1; @@ -550,8 +539,7 @@ // dbs - group $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup'); $dbAnalysis->start($row[$field],$fieldConf['allowed'],$fieldConf['MM'],$row['uid'], $table, $fieldConf); - reset($dbAnalysis->itemArray); - while (list(,$tempArr)=each($dbAnalysis->itemArray)) { + foreach($dbAnalysis->itemArray as $tempArr) { $this->checkGroupDBRefs[$tempArr['table']][$tempArr['id']]+=1; } } @@ -560,8 +548,7 @@ // dbs - select $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup'); $dbAnalysis->start($row[$field],$fieldConf['foreign_table'],$fieldConf['MM'],$row['uid'], $table, $fieldConf); - reset($dbAnalysis->itemArray); - while (list(,$tempArr)=each($dbAnalysis->itemArray)) { + foreach($dbAnalysis->itemArray as $tempArr) { if ($tempArr['id']>0) { $this->checkGroupDBRefs[$fieldConf['foreign_table']][$tempArr['id']]+=1; } @@ -570,6 +557,7 @@ } } } + $GLOBALS['TYPO3_DB']->sql_free_result($mres); } } } @@ -607,8 +595,7 @@ } $this->checkFileRefs = $newCheckFileRefs; - reset($this->checkFileRefs); - while(list($folder,$fileArr)=each($this->checkFileRefs)) { + foreach($this->checkFileRefs as $folder => $fileArr) { $path = PATH_site.$folder; if (@is_dir($path)) { $d = dir($path); @@ -705,7 +692,7 @@ global $TCA; $fileFields = $this->getDBFields($searchTable); // Gets tables / Fields that reference to files... $theRecordList=Array(); - while (list(,$info)=each($fileFields)) { + foreach ($fileFields as $info) { $table=$info[0]; $field=$info[1]; t3lib_div::loadTCA($table); $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery( @@ -727,6 +714,7 @@ } } } + $GLOBALS['TYPO3_DB']->sql_free_result($mres); } return $theRecordList; } Index: t3lib/class.t3lib_formmail.php =================================================================== --- t3lib/class.t3lib_formmail.php (Revision 6977) +++ t3lib/class.t3lib_formmail.php (Arbeitskopie) @@ -141,8 +141,7 @@ // Runs through $V and generates the mail if (is_array($V)) { - reset($V); - while (list($key,$val)=each($V)) { + foreach ($V as $key => $val) { if (!t3lib_div::inList($this->reserved_names,$key)) { $space = (strlen($val)>60)?chr(10):''; $val = (is_array($val) ? implode($val,chr(10)) : $val); Index: t3lib/class.t3lib_stdgraphic.php =================================================================== --- t3lib/class.t3lib_stdgraphic.php (Revision 6977) +++ t3lib/class.t3lib_stdgraphic.php (Arbeitskopie) @@ -2635,7 +2635,7 @@ if ($splitstring) { preg_match('/([^\.]*)$/',$imagefile,$reg); $splitinfo = explode(' ', $splitstring); - while (list($key,$val) = each($splitinfo)) { + foreach ($splitinfo as $key => $val) { $temp = ''; if ($val) {$temp = explode('x', $val);} if (intval($temp[0]) && intval($temp[1])) { Index: t3lib/class.t3lib_tsparser_ext.php =================================================================== --- t3lib/class.t3lib_tsparser_ext.php (Revision 6977) +++ t3lib/class.t3lib_tsparser_ext.php (Arbeitskopie) @@ -298,8 +298,7 @@ $c=0; $cc=count($this->constants); - reset($this->constants); - while (list(,$str)=each($this->constants)) { + foreach($this->constants as $str) { $c++; if ($c==$cc) { if (strstr($str,$this->edit_divider)) { @@ -360,13 +359,12 @@ $HTML=''; $a=0; - reset($arr); if($alphaSort == '1') { ksort($arr); } $keyArr_num=array(); $keyArr_alpha=array(); - while (list($key,)=each($arr)) { + foreach ($arr as $key => $value) { if (substr($key,-2)!='..') { // Don't do anything with comments / linenumber registrations... $key=preg_replace('/\.$/','',$key); if (substr($key,-1)!='.') { @@ -380,11 +378,10 @@ } ksort($keyArr_num); $keyArr=$keyArr_num+$keyArr_alpha; - reset($keyArr); $c=count($keyArr); if ($depth_in) {$depth_in = $depth_in.'.';} - while (list($key,)=each($keyArr)) { + foreach ($keyArr as $key => $value) { $a++; $depth=$depth_in.$key; if ($this->bType!='const' || substr($depth,0,1)!='_') { // this excludes all constants starting with '_' from being shown. @@ -515,10 +512,9 @@ $keyArr[$key]=1; } } - reset($keyArr); $c=count($keyArr); if ($depth_in) { $depth_in = $depth_in.'.'; } - while (list($key,)=each($keyArr)) { + foreach ($keyArr as $key => $value) { $depth=$depth_in.$key; $deeper = is_array($arr[$key.'.']); @@ -580,19 +576,17 @@ * @return [type] ... */ function ext_getTemplateHierarchyArr($arr,$depthData, $keyArray,$first=0) { - reset($arr); $keyArr=array(); - while (list($key,)=each($arr)) { + foreach ($arr as $key => $value) { $key=preg_replace('/\.$/','',$key); if (substr($key,-1)!='.') { $keyArr[$key]=1; } } - reset($keyArr); $a=0; $c=count($keyArr); static $i; - while (list($key,)=each($keyArr)) { + foreach ($keyArr as $key => $value) { $HTML = ''; $a++; $deeper = is_array($arr[$key . '.']); @@ -679,8 +673,7 @@ */ function ext_outputTS($config, $lineNumbers=0, $comments=0, $crop=0, $syntaxHL=0, $syntaxHLBlockmode=0) { $all=''; - reset($config); - while (list(,$str)=each($config)) { + foreach($config as $str) { $all .= chr(10) .'[GLOBAL]' . chr(10) . $str; } @@ -899,8 +892,7 @@ $constData['type']='string'; } $cats = explode(',',$constData['cat']); - reset($cats); - while (list(,$theCat)=each($cats)) { // if = only one category, while allows for many. We have agreed on only one category is the most basic way... + foreach ($cats as $theCat) { // if = only one category, while allows for many. We have agreed on only one category is the most basic way... $theCat=trim($theCat); if ($theCat) { $this->categories[$theCat][$constName]=$constData['subcat']; Index: t3lib/class.t3lib_tstemplate.php =================================================================== --- t3lib/class.t3lib_tstemplate.php (Revision 6977) +++ t3lib/class.t3lib_tstemplate.php (Arbeitskopie) @@ -1265,8 +1265,7 @@ function checkFile($name,$menuArr) { t3lib_div::logDeprecatedFunction(); - reset ($menuArr); - while (list($aKey,)=each($menuArr)) { + foreach ($menuArr as $aKey => $value) { $menuArr[$aKey][$name] = $this->getFileName($menuArr[$aKey][$name]); } return $menuArr; Index: typo3/class.db_list.inc =================================================================== --- typo3/class.db_list.inc (Revision 6977) +++ typo3/class.db_list.inc (Arbeitskopie) @@ -243,8 +243,7 @@ $this->pageRecord = t3lib_BEfunc::getRecordWSOL('pages',$this->id); // Traverse the TCA table array: - reset($TCA); - while (list($tableName)=each($TCA)) { + foreach ($TCA as $tableName => $value) { // Checking if the table should be rendered: if ((!$this->table || $tableName==$this->table) && (!$this->tableList || t3lib_div::inList($this->tableList,$tableName)) && $GLOBALS['BE_USER']->check('tables_select',$tableName)) { // Checks that we see only permitted/requested tables: Index: typo3/class.file_list.inc =================================================================== --- typo3/class.file_list.inc (Revision 7020) +++ typo3/class.file_list.inc (Arbeitskopie) @@ -319,8 +319,7 @@ // Folders: if (count($items['sorting'])) { - reset($items['sorting']); - while (list($key,) = each($items['sorting'])) { + foreach ($items['sorting'] as $key => $value) { list($flag,$code) = $this->fwd_rwd_nav(); $out.=$code; if ($flag) { @@ -462,8 +461,7 @@ // Files: if (count($items['sorting'])) { - reset($items['sorting']); - while (list($key,) = each($items['sorting'])) { + foreach ($items['sorting'] as $key => $value) { list($flag,$code) = $this->fwd_rwd_nav(); $out.=$code; if ($flag) { @@ -605,8 +603,7 @@ $d->close(); } // Get fileinfo - reset($tempArray); - while (list(,$val)=each($tempArray)) { + foreach ($tempArray as $val) { $temp = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($val); $items['files'][] = $temp; if ($this->sort) { Index: typo3/mod/tools/em/class.em_xmlhandler.php =================================================================== --- typo3/mod/tools/em/class.em_xmlhandler.php (Revision 6977) +++ typo3/mod/tools/em/class.em_xmlhandler.php (Arbeitskopie) @@ -202,8 +202,7 @@ function removeObsolete(&$extensions) { if($this->useObsolete) return; - reset($extensions); - while (list($version, $data) = each($extensions)) { + foreach ($extensions as $version => $data) { if($data['state']=='obsolete') unset($extensions[$version]); } @@ -235,8 +234,7 @@ function checkReviewState(&$extensions) { if ($this->useUnchecked) return; - reset($extensions); - while (list($version, $data) = each($extensions)) { + foreach ($extensions as $version => $data) { if($data['reviewstate']<1) unset($extensions[$version]); } Index: typo3/sysext/adodb/adodb/adodb-error.inc.php =================================================================== --- typo3/sysext/adodb/adodb/adodb-error.inc.php (Revision 6977) +++ typo3/sysext/adodb/adodb/adodb-error.inc.php (Arbeitskopie) @@ -102,8 +102,7 @@ '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i' => DB_ERROR_ALREADY_EXISTS ); - reset($error_regexps); - while (list($regexp,$code) = each($error_regexps)) { + foreach ($error_regexps as $regexp => $code) { if (preg_match($regexp, $errormsg)) { return $code; } Index: typo3/sysext/dbal/class.ux_t3lib_db.php =================================================================== --- typo3/sysext/dbal/class.ux_t3lib_db.php (Revision 6977) +++ typo3/sysext/dbal/class.ux_t3lib_db.php (Arbeitskopie) @@ -2075,7 +2075,7 @@ break; case 'adodb': $sqlTables = $this->handlerInstance['_DEFAULT']->MetaTables('TABLES'); - while (list($k, $theTable) = each($sqlTables)) { + foreach ($sqlTables as $k => $theTable) { if (preg_match('/BIN\$/', $theTable)) continue; // skip tables from the Oracle 10 Recycle Bin $whichTables[$theTable] = $theTable; } @@ -2216,7 +2216,7 @@ case 'adodb': $keyRows = $this->handlerInstance[$this->lastHandlerKey]->MetaIndexes($tableName); if ($keyRows !== FALSE) { - while (list($k, $theKey) = each($keyRows)) { + foreach ($keyRows as $k => $theKey) { $theKey['Table'] = $tableName; $theKey['Non_unique'] = (int) !$theKey['unique']; $theKey['Key_name'] = str_replace($tableName.'_','',$k); @@ -2232,7 +2232,7 @@ // now map multiple fields into multiple rows (we mimic MySQL, remember...) $keycols = $theKey['columns']; - while (list($c, $theCol) = each($keycols)) { + foreach ($keycols as $c => $theCol) { $theKey['Seq_in_index'] = $c+1; $theKey['Column_name'] = $theCol; $output[] = $theKey; Index: typo3/sysext/extbase/Classes/Utility/Arrays.php =================================================================== --- typo3/sysext/extbase/Classes/Utility/Arrays.php (Revision 6977) +++ typo3/sysext/extbase/Classes/Utility/Arrays.php (Arbeitskopie) @@ -47,10 +47,9 @@ */ static public function integerExplode($delimiter, $string) { $chunksArr = explode($delimiter, $string); - while (list($key, $value) = each($chunksArr)) { + foreach ($chunksArr as $key => $value) { $chunks[$key] = intval($value); } - reset($chunks); return $chunks; } @@ -88,8 +87,7 @@ * @api */ static public function arrayMergeRecursiveOverrule(array $firstArray, array $secondArray, $dontAddNewKeys = FALSE, $emptyValuesOverride = TRUE) { - reset($secondArray); - while (list($key, $value) = each($secondArray)) { + foreach ($secondArray as $key => $value) { if (array_key_exists($key, $firstArray) && is_array($firstArray[$key])) { if (is_array($secondArray[$key])) { $firstArray[$key] = self::arrayMergeRecursiveOverrule($firstArray[$key], $secondArray[$key], $dontAddNewKeys, $emptyValuesOverride); Index: typo3/sysext/extbase/Classes/Utility/Extension.php =================================================================== --- typo3/sysext/extbase/Classes/Utility/Extension.php (Revision 6977) +++ typo3/sysext/extbase/Classes/Utility/Extension.php (Arbeitskopie) @@ -471,7 +471,7 @@ $returnValue = false; // Iterate with while since we need the current array position: - while (list(,$token) = each($tokenList)) { + foreach ($tokenList as $token) { // parse token (see http://www.php.net/manual/en/function.token-get-all.php for format of token list) if (is_array($token)) { list($id, $text) = $token; Index: typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_dam_browse_links.php =================================================================== --- typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_dam_browse_links.php (Revision 6977) +++ typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_dam_browse_links.php (Arbeitskopie) @@ -246,8 +246,7 @@ } } } - reset($anchorTypes); - while (list(, $anchorType) = each($anchorTypes) ) { + foreach ($anchorTypes as $anchorType) { reset($classesAnchorArray); while(list(,$class)=each($classesAnchorArray)) { if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {