move $this->initialiseVariables down to where the variables are used the first time...
authorJens Frank <jeluf@users.mediawiki.org>
Tue, 13 Jul 2004 06:42:55 +0000 (06:42 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Tue, 13 Jul 2004 06:42:55 +0000 (06:42 +0000)
includes/Parser.php

index 5412334..4e0913b 100644 (file)
@@ -1450,9 +1450,6 @@ class Parser
                wfProfileIn( $fname );
 
                $bail = false;
-               if ( !$this->mVariables ) {
-                       $this->initialiseVariables();
-               }
                $titleChars = Title::legalChars();
                $nonBraceChars = str_replace( array( '{', '}' ), array( '', '' ), $titleChars );
 
@@ -1481,6 +1478,9 @@ class Parser
        }
 
        function variableSubstitution( $matches ) {
+               if ( !$this->mVariables ) {
+                       $this->initialiseVariables();
+               }
                if ( array_key_exists( $matches[1], $this->mVariables ) ) {
                        $text = $this->mVariables[$matches[1]];
                        $this->mOutput->mContainsOldMagic = true;
@@ -1605,6 +1605,9 @@ class Parser
                }
 
                # Internal variables
+               if ( !$this->mVariables ) {
+                       $this->initialiseVariables();
+               }
                if ( !$found && array_key_exists( $part1, $this->mVariables ) ) {
                        $text = $this->mVariables[$part1];
                        $found = true;