Index: trunk/phase3/includes/Parser.php |
— | — | @@ -99,16 +99,16 @@ |
100 | 100 | var $mOutput, $mAutonumber, $mDTopen, $mStripState = array(); |
101 | 101 | var $mVariables, $mIncludeCount, $mArgStack, $mLastSection, $mInPre; |
102 | 102 | var $mInterwikiLinkHolders, $mLinkHolders, $mUniqPrefix; |
| 103 | + var $mTemplates, // cache of already loaded templates, avoids |
| 104 | + // multiple SQL queries for the same string |
| 105 | + $mTemplatePath; // stores an unsorted hash of all the templates already loaded |
| 106 | + // in this path. Used for loop detection. |
103 | 107 | |
104 | | - # Temporary: |
| 108 | + # Temporary |
| 109 | + # These are variables reset at least once per parse regardless of $clearState |
105 | 110 | var $mOptions, // ParserOptions object |
106 | 111 | $mTitle, // Title context, used for self-link rendering and similar things |
107 | 112 | $mOutputType, // Output type, one of the OT_xxx constants |
108 | | - $mTemplates, // cache of already loaded templates, avoids |
109 | | - // multiple SQL queries for the same string |
110 | | - $mTemplatePath, // stores an unsorted hash of all the templates already loaded |
111 | | - // in this path. Used for loop detection. |
112 | | - $mIWTransData = array(), |
113 | 113 | $mRevisionId; // ID to display in {{REVISIONID}} tags |
114 | 114 | |
115 | 115 | /**#@-*/ |
— | — | @@ -119,8 +119,6 @@ |
120 | 120 | * @access public |
121 | 121 | */ |
122 | 122 | function Parser() { |
123 | | - $this->mTemplates = array(); |
124 | | - $this->mTemplatePath = array(); |
125 | 123 | $this->mTagHooks = array(); |
126 | 124 | $this->clearState(); |
127 | 125 | } |
— | — | @@ -154,6 +152,10 @@ |
155 | 153 | $this->mRevisionId = null; |
156 | 154 | $this->mUniqPrefix = 'UNIQ' . Parser::getRandomString(); |
157 | 155 | |
| 156 | + # Clear these on every parse, bug 4549 |
| 157 | + $this->mTemplates = array(); |
| 158 | + $this->mTemplatePath = array(); |
| 159 | + |
158 | 160 | wfRunHooks( 'ParserClearState', array( &$this ) ); |
159 | 161 | } |
160 | 162 | |
— | — | @@ -829,18 +831,10 @@ |
830 | 832 | $text = $this->doTableStuff( $text ); |
831 | 833 | $text = $this->formatHeadings( $text, $isMain ); |
832 | 834 | |
833 | | - $regex = '/<!--IW_TRANSCLUDE (\d+)-->/'; |
834 | | - $text = preg_replace_callback($regex, array(&$this, 'scarySubstitution'), $text); |
835 | | - |
836 | 835 | wfProfileOut( $fname ); |
837 | 836 | return $text; |
838 | 837 | } |
839 | 838 | |
840 | | - function scarySubstitution($matches) { |
841 | | -# return "[[".$matches[0]."]]"; |
842 | | - return $this->mIWTransData[(int)$matches[0]]; |
843 | | - } |
844 | | - |
845 | 839 | /** |
846 | 840 | * Replace special strings like "ISBN xxx" and "RFC xxx" with |
847 | 841 | * magic external links. |