From: Tim Starling Date: Fri, 16 Mar 2012 00:29:26 +0000 (+0000) Subject: In the $clearState=true case, remove strip marker prefixes from the Parser::parse... X-Git-Tag: 1.31.0-rc.0~24233 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=f15a91f2931bf32745d925a41668b31e4602ef82;p=lhc%2Fweb%2Fwiklou.git 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. --- 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;