r28004 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28003‎ | r28004 | r28005 >
Date:06:52, 1 December 2007
Author:tstarling
Status:old
Tags:
Comment:
Don't destroy parser state in cleanSig(). Possible fix for bug 12154, pending confirmation.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -4148,18 +4148,27 @@
41494149 * @return string Signature text
41504150 */
41514151 function cleanSig( $text, $parsing = false ) {
4152 - global $wgTitle;
4153 - $this->startExternalParse( $wgTitle, new ParserOptions(), $parsing ? OT_WIKI : OT_MSG );
 4152+ if ( !$parsing ) {
 4153+ global $wgTitle;
 4154+ $this->startExternalParse( $wgTitle, new ParserOptions(), OT_MSG );
 4155+ }
41544156
 4157+ # FIXME: regex doesn't respect extension tags or nowiki
 4158+ # => Move this logic to braceSubstitution()
41554159 $substWord = MagicWord::get( 'subst' );
41564160 $substRegex = '/\{\{(?!(?:' . $substWord->getBaseRegex() . '))/x' . $substWord->getRegexCase();
41574161 $substText = '{{' . $substWord->getSynonym( 0 );
41584162
41594163 $text = preg_replace( $substRegex, $substText, $text );
41604164 $text = $this->cleanSigInSig( $text );
4161 - $text = $this->replaceVariables( $text );
 4165+ $dom = $this->preprocessToDom( $text );
 4166+ $frame = new PPFrame( $this );
 4167+ $text = $frame->expand( $dom->documentElement );
41624168
4163 - $this->clearState();
 4169+ if ( !$parsing ) {
 4170+ $text = $this->mStripState->unstripBoth( $text );
 4171+ }
 4172+
41644173 return $text;
41654174 }
41664175

Status & tagging log