[TASK] Fix TYPO3.ControlStructures.DisallowEachInLoopCondition
authorAndy Grunwald <andygrunwald@gmail.com>
Fri, 21 Sep 2012 20:06:23 +0000 (22:06 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 21 Sep 2012 21:32:06 +0000 (23:32 +0200)
Change-Id: I1f902a2abb559c8ba12c593143921f9cbd8c4bc1
Fixes: #41211
Releases: 6.0
Reviewed-on: http://review.typo3.org/14875
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_readmail.php
typo3/sysext/core/Classes/Database/QueryGenerator.php
typo3/sysext/core/Classes/Database/QueryView.php
typo3/sysext/core/Classes/Html/HtmlParser.php
typo3/sysext/core/Classes/Utility/MathUtility.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/install/Classes/Installer.php
typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php
typo3/sysext/statictemplates/media/scripts/plaintextLib.inc

index 367766a..b2e79ef 100644 (file)
@@ -145,7 +145,7 @@ class t3lib_readmail {
                $cTypes = array();
                $cTypes['ContentType'] = $parts[0];
                next($parts);
-               while (list(, $ppstr) = each($parts)) {
+               foreach ($parts as $ppstr) {
                        $mparts = explode('=', $ppstr, 2);
                        if (count($mparts) > 1) {
                                $cTypes[strtolower(trim($mparts[0]))] = preg_replace('/^"/', '', trim(preg_replace('/"$/', '', trim($mparts[1]))));
index 436dca4..8502605 100644 (file)
@@ -860,7 +860,7 @@ class QueryGenerator {
                        }
                        $counter = 0;
                        $webMountPageTree = '';
-                       while (list(, $from_table) = each($from_table_Arr)) {
+                       foreach ($from_table_Arr as $from_table) {
                                if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
                                        $tablePrefix = $from_table . '_';
                                }
index a175099..169bf2e 100644 (file)
@@ -774,7 +774,7 @@ class QueryView {
                        }
                        $d->close();
                        natcasesort($fileArray);
-                       while (list(, $fileName) = each($fileArray)) {
+                       foreach ($fileArray as $fileName) {
                                if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($fV, $fileName) || $fV == $fileName) {
                                        if (!$out) {
                                                $out = htmlspecialchars($fileName);
index 872100d..4584c27 100644 (file)
@@ -332,7 +332,7 @@ class HtmlParser {
                $nested = 0;
                reset($parts);
                next($parts);
-               while (list($k, $v) = each($parts)) {
+               foreach ($parts as $k => $v) {
                        $isEndTag = substr($content, $pointer, 2) == '</' ? 1 : 0;
                        $tagLen = strcspn(substr($content, $pointer), '>') + 1;
                        // We meet a start-tag:
@@ -434,7 +434,7 @@ class HtmlParser {
                $newParts[] = $parts[0];
                reset($parts);
                next($parts);
-               while (list($k, $v) = each($parts)) {
+               foreach ($parts as $k => $v) {
                        $tagLen = strcspn(substr($content, $pointer), '>') + 1;
                        // Set tag:
                        // New buffer set and pointer increased
@@ -711,7 +711,7 @@ class HtmlParser {
                $tagStack = array();
                $inComment = FALSE;
                $skipTag = FALSE;
-               while (list(, $tok) = each($tokArr)) {
+               foreach ($tokArr as $tok) {
                        if ($inComment) {
                                if (($eocPos = strpos($tok, '-->')) === FALSE) {
                                        // End of comment is not found in the token. Go further until end of comment is found in other tokens.
@@ -1172,7 +1172,7 @@ class HtmlParser {
                $contentParts = explode('&lt;', $content);
                next($contentParts);
                // bypass the first
-               while (list($k, $tok) = each($contentParts)) {
+               foreach ($contentParts as $k => $tok) {
                        $firstChar = substr($tok, 0, 1);
                        if (strcmp(trim($firstChar), '')) {
                                $subparts = explode('&gt;', $tok, 2);
index 0a9d6b7..f77da62 100644 (file)
@@ -115,7 +115,7 @@ final class MathUtility {
                $buffer = doubleval(current($reg[2]));
                // Advance pointer
                next($reg[2]);
-               while (list($k, $v) = each($reg[2])) {
+               foreach ($reg[2] as $k => $v) {
                        $v = doubleval($v);
                        $sign = $reg[1][$k];
                        if ($sign == '+' || $sign == '-') {
index a8c0d3a..31e9ba7 100644 (file)
@@ -5172,7 +5172,10 @@ class ContentObjectRenderer {
                }
                $retVal = '';
                $sections = explode('//', $string);
-               while (!$retVal and list($secKey, $secVal) = each($sections)) {
+               foreach ($sections as $secKey => $secVal) {
+                       if ($retVal) {
+                               break;
+                       }
                        $parts = explode(':', $secVal, 2);
                        $key = trim($parts[1]);
                        if ((string) $key != '') {
index 74e736b..88431af 100644 (file)
@@ -2597,9 +2597,8 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
                        $rows = array();
                        foreach ($this->config_array['im_versions'] as $p => $v) {
                                $ka = array();
-                               reset($v);
-                               while (list($ka[]) = each($v)) {
-
+                               foreach ($v as $key => $value) {
+                                       $ka[] = $key;
                                }
                                // Define the markers content
                                $rowsMarkers = array(
@@ -7161,4 +7160,4 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
 }
 
 
-?>
\ No newline at end of file
+?>
index ed52984..057c129 100644 (file)
@@ -520,7 +520,7 @@ var selectedDictionary = "' . $this->dictionary . '";
                $incurrent = array();
                $stringText = $string;
                $words = preg_split($this->parserCharset == 'utf-8' ? '/\\P{L}+/u' : '/\\W+/', $stringText);
-               while (list(, $word) = each($words)) {
+               foreach ($words as $word) {
                        $word = preg_replace('/ /' . ($this->parserCharset == 'utf-8' ? 'u' : ''), '', $word);
                        if ($word && !is_numeric($word)) {
                                if ($this->pspell_is_available && !$this->forceCommandMode) {
@@ -615,4 +615,4 @@ var selectedDictionary = "' . $this->dictionary . '";
 }
 
 
-?>
\ No newline at end of file
+?>
index 3ced4fc..97f9001 100644 (file)
@@ -503,7 +503,7 @@ class user_plaintext {
                if ($this->conf['images.']['header']) {
                        $lines[] = $this->getString($this->conf['images.']['header']);
                }
-               while (list($k, $file) = each($images)) {
+               foreach ($images as $k => $file) {
                        $lines[] = ($this->siteUrl . $upload_path) . $file;
                        if ($links && count($linksArr) > 1) {
                                if (isset($linksArr[$k])) {