From b6875ddacc60e050523f0bdc35a6c1328c0794f6 Mon Sep 17 00:00:00 2001 From: Platonides Date: Sun, 23 Jan 2011 18:45:21 +0000 Subject: [PATCH] Accept being passed a null Title to startExternalParse(), at the callers responsibility. Added a note about getUserSig() side-effects. --- includes/parser/Parser.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index aa7204f5e9..5a8370802d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4125,6 +4125,9 @@ class Parser { # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags $text = $this->replaceVariables( $text ); + # This works almost by chance, as the replaceVariables are done before the getUserSig(), + # which may corrupt this parser instance via its wfMsgExt( parsemag ) call- + # Signatures $sigText = $this->getUserSig( $user ); $text = strtr( $text, array( @@ -4170,6 +4173,8 @@ class Parser { * validated, ready-to-insert wikitext. * If you have pre-fetched the nickname or the fancySig option, you can * specify them here to save a database query. + * Do not reuse this parser instance after calling getUserSig(), + * as it may have changed if it's the $wgParser. * * @param $user User * @param $nickname String: nickname to use or false to use user's default nickname @@ -4288,7 +4293,7 @@ class Parser { * Set up some variables which are usually set up in parse() * so that an external function can call some class members with confidence */ - public function startExternalParse( Title $title, ParserOptions $options, $outputType, $clearState = true ) { + public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) { $this->setTitle( $title ); $this->mOptions = $options; $this->setOutputType( $outputType ); -- 2.20.1