From f15a91f2931bf32745d925a41668b31e4602ef82 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 16 Mar 2012 00:29:26 +0000 Subject: [PATCH] In the $clearState=true case, remove strip marker prefixes from the Parser::parse() input. It's only possible for strip markers to be present in this case if the caller manages to guess the output of Parser::getRandomString() in advance. Even if that is possible, it's not recommended as a robust calling procedure. Also cleaned up some old commented-out code in this area. --- includes/parser/Parser.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 3dff643062..e09e757a12 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -273,8 +273,6 @@ class Parser { * Must not consist of all title characters, or else it will change * the behaviour of in a link. */ - # $this->mUniqPrefix = "\x07UNIQ" . Parser::getRandomString(); - # Changed to \x7f to allow XML double-parsing -- TS $this->mUniqPrefix = "\x7fUNIQ" . self::getRandomString(); $this->mStripState = new StripState( $this->mUniqPrefix ); @@ -328,6 +326,11 @@ class Parser { $this->startParse( $title, $options, self::OT_HTML, $clearState ); + # Remove the strip marker tag prefix from the input, if present. + if ( $clearState ) { + $text = str_replace( $this->mUniqPrefix, '', $text ); + } + $oldRevisionId = $this->mRevisionId; $oldRevisionObject = $this->mRevisionObject; $oldRevisionTimestamp = $this->mRevisionTimestamp; -- 2.20.1