Merge "Declare and document $wgStatsdServer and $wgStatsdMetricPrefix"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index f86e731..1603fc6 100644 (file)
@@ -1438,7 +1438,7 @@ class Parser {
                                '-' => '',
                                ' ' => '',
                                'x' => 'X',
-                       ));
+                       ) );
                        $titleObj = SpecialPage::getTitleFor( 'Booksources', $num );
                        return '<a href="' .
                                htmlspecialchars( $titleObj->getLocalURL() ) .
@@ -1481,7 +1481,7 @@ class Parser {
                # Don't break a trailing HTML entity by moving the ; into $trail
                # This is in hot code, so use substr_compare to avoid having to
                # create a new string object for the comparison
-               if ( $numSepChars && substr_compare( $url, ";", -$numSepChars, 1 ) === 0) {
+               if ( $numSepChars && substr_compare( $url, ";", -$numSepChars, 1 ) === 0 ) {
                        # more optimization: instead of running preg_match with a $
                        # anchor, which can be slow, do the match on the reversed
                        # string starting at the desired offset.
@@ -3438,7 +3438,6 @@ class Parser {
 
                # SUBST
                if ( !$found ) {
-
                        $substMatch = $this->mSubstWords->matchStartAndRemove( $part1 );
 
                        # Possibilities for substMatch: "subst", "safesubst" or FALSE
@@ -3496,7 +3495,6 @@ class Parser {
 
                # Parser functions
                if ( !$found ) {
-
                        $colonPos = strpos( $part1, ':' );
                        if ( $colonPos !== false ) {
                                $func = substr( $part1, 0, $colonPos );
@@ -4449,7 +4447,9 @@ class Parser {
                $tocraw = array();
                $refers = array();
 
-               foreach ( $matches[3] as $headline ) {
+               $headlines = $numMatches !== false ? $matches[3] : array();
+
+               foreach ( $headlines as $headline ) {
                        $isTemplate = false;
                        $titleText = false;
                        $sectionIndex = false;
@@ -5075,7 +5075,7 @@ class Parser {
         * in the Parser class.
         *
         * This interface (introduced r61913) appears to be undocumented, but
-        * 'markerName' is used by some core tag hooks to override which strip
+        * 'markerType' is used by some core tag hooks to override which strip
         * array their results are placed in. **Use great caution if attempting
         * this interface, as it is not documented and injudicious use could smash
         * private variables.**