From 416187b7a4c0875547d60fbbdf3bb0a26978b938 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 1 Dec 2007 06:52:25 +0000 Subject: [PATCH] Don't destroy parser state in cleanSig(). Possible fix for bug 12154, pending confirmation. --- includes/Parser.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 17495682cb..372b95d62f 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4148,18 +4148,27 @@ class Parser * @return string Signature text */ function cleanSig( $text, $parsing = false ) { - global $wgTitle; - $this->startExternalParse( $wgTitle, new ParserOptions(), $parsing ? OT_WIKI : OT_MSG ); + if ( !$parsing ) { + global $wgTitle; + $this->startExternalParse( $wgTitle, new ParserOptions(), OT_MSG ); + } + # FIXME: regex doesn't respect extension tags or nowiki + # => Move this logic to braceSubstitution() $substWord = MagicWord::get( 'subst' ); $substRegex = '/\{\{(?!(?:' . $substWord->getBaseRegex() . '))/x' . $substWord->getRegexCase(); $substText = '{{' . $substWord->getSynonym( 0 ); $text = preg_replace( $substRegex, $substText, $text ); $text = $this->cleanSigInSig( $text ); - $text = $this->replaceVariables( $text ); + $dom = $this->preprocessToDom( $text ); + $frame = new PPFrame( $this ); + $text = $frame->expand( $dom->documentElement ); + + if ( !$parsing ) { + $text = $this->mStripState->unstripBoth( $text ); + } - $this->clearState(); return $text; } -- 2.20.1