foreach loop is pointless if you're then just going to keep a counter manually
authorSam Reed <reedy@users.mediawiki.org>
Wed, 10 Nov 2010 19:19:46 +0000 (19:19 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Wed, 10 Nov 2010 19:19:46 +0000 (19:19 +0000)
Hence switch foreach to for loop

includes/parser/Parser.php

index 4a83524..c1ac704 100644 (file)
@@ -1260,10 +1260,9 @@ class Parser {
                        # First, do some preliminary work. This may shift some apostrophes from
                        # being mark-up to being text. It also counts the number of occurrences
                        # of bold and italics mark-ups.
-                       $i = 0;
                        $numbold = 0;
                        $numitalics = 0;
-                       foreach ( $arr as $r ) {
+                       for ( $i = 0; $i < count( $arr ); $i++ ) {
                                if ( ( $i % 2 ) == 1 ) {
                                        # If there are ever four apostrophes, assume the first is supposed to
                                        # be text, and the remaining three constitute mark-up for bold text.
@@ -1287,7 +1286,6 @@ class Parser {
                                                $numbold++;
                                        }
                                }
-                               $i++;
                        }
 
                        # If there is an odd number of both bold and italics, it is likely