don't error on certain inputs if $matches[] doesn't have a last element
authorRiver Tarnell <kateturner@users.mediawiki.org>
Tue, 21 Sep 2004 19:03:39 +0000 (19:03 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Tue, 21 Sep 2004 19:03:39 +0000 (19:03 +0000)
includes/Parser.php

index 1275648..04ab74f 100644 (file)
@@ -1858,10 +1858,9 @@ class Parser
                                $nsec = 0;
                                for( $i = 0; $i < count($matches); $i += 2 ) {
                                        wfDebug("text=[".$matches[$i]."] heading=[".$matches[$i+1]."]\n");
-                                       if ($matches[$i] == "" && $matches[$i + 1] == "") break;
                                        $text .= $matches[$i];
+                                       if (!isset($matches[$i + 1]) || $matches[$i + 1] == "") continue;
                                        $hl = $matches[$i + 1];
-                                       if ($hl == "") continue;
                                        if( strstr($hl, "<!--MWTEMPLATESECTION") ) {
                                                $text .= $hl;
                                                continue;