Bug 4549. "Temporary" means that it's cleared in parse() or some other frequently...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 2 Feb 2006 13:42:50 +0000 (13:42 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 2 Feb 2006 13:42:50 +0000 (13:42 +0000)
includes/Parser.php

index 13b5f2e..2b89d92 100644 (file)
@@ -99,16 +99,16 @@ class Parser
        var $mOutput, $mAutonumber, $mDTopen, $mStripState = array();
        var $mVariables, $mIncludeCount, $mArgStack, $mLastSection, $mInPre;
        var $mInterwikiLinkHolders, $mLinkHolders, $mUniqPrefix;
+       var $mTemplates,        // cache of already loaded templates, avoids
+                               // multiple SQL queries for the same string
+           $mTemplatePath;     // stores an unsorted hash of all the templates already loaded
+                               // in this path. Used for loop detection.
 
-       # Temporary:
+       # Temporary
+       # These are variables reset at least once per parse regardless of $clearState
        var $mOptions,      // ParserOptions object
                $mTitle,        // Title context, used for self-link rendering and similar things
                $mOutputType,   // Output type, one of the OT_xxx constants
-           $mTemplates,        // cache of already loaded templates, avoids
-                               // multiple SQL queries for the same string
-           $mTemplatePath,     // stores an unsorted hash of all the templates already loaded
-                               // in this path. Used for loop detection.
-               $mIWTransData = array(),
                $mRevisionId;   // ID to display in {{REVISIONID}} tags
 
        /**#@-*/
@@ -119,8 +119,6 @@ class Parser
         * @access public
         */
        function Parser() {
-               $this->mTemplates = array();
-               $this->mTemplatePath = array();
                $this->mTagHooks = array();
                $this->clearState();
        }
@@ -154,6 +152,10 @@ class Parser
                $this->mRevisionId = null;
                $this->mUniqPrefix = 'UNIQ' . Parser::getRandomString();
 
+               # Clear these on every parse, bug 4549
+               $this->mTemplates = array();
+               $this->mTemplatePath = array();
+
                wfRunHooks( 'ParserClearState', array( &$this ) );
        }
 
@@ -829,18 +831,10 @@ class Parser
                $text = $this->doTableStuff( $text );
                $text = $this->formatHeadings( $text, $isMain );
 
-               $regex = '/<!--IW_TRANSCLUDE (\d+)-->/';
-               $text = preg_replace_callback($regex, array(&$this, 'scarySubstitution'), $text);
-
                wfProfileOut( $fname );
                return $text;
        }
 
-       function scarySubstitution($matches) {
-#              return "[[".$matches[0]."]]";
-               return $this->mIWTransData[(int)$matches[0]];
-       }
-
        /**
         * Replace special strings like "ISBN xxx" and "RFC xxx" with
         * magic external links.