From 405bc4d9988e07354dd8fcb8034c7fb9484a1fb6 Mon Sep 17 00:00:00 2001 From: Platonides Date: Fri, 15 Oct 2010 22:12:19 +0000 Subject: [PATCH] Follow r69904. Make Parser::getRandomString real private. Parser_DiffTest::dtUniqPrefix is now lazyloader. I also fixed the typo in its declaration. --- includes/parser/Parser.php | 2 +- includes/parser/Parser_DiffTest.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 26be8b9d43..fe6dbfb5a4 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -494,7 +494,7 @@ class Parser { * @private * @static */ - static function getRandomString() { + static private function getRandomString() { return dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) ); } diff --git a/includes/parser/Parser_DiffTest.php b/includes/parser/Parser_DiffTest.php index b6a7367112..ef98fe0bba 100644 --- a/includes/parser/Parser_DiffTest.php +++ b/includes/parser/Parser_DiffTest.php @@ -13,14 +13,13 @@ class Parser_DiffTest var $parsers, $conf; var $shortOutput = false; - var $dfUniqPrefix; + var $dtUniqPrefix; function __construct( $conf ) { if ( !isset( $conf['parsers'] ) ) { throw new MWException( __METHOD__ . ': no parsers specified' ); } $this->conf = $conf; - $this->dtUniqPrefix = "\x7fUNIQ" . Parser::getRandomString(); } function init() { @@ -114,7 +113,11 @@ class Parser_DiffTest function onClearState( &$parser ) { // hack marker prefixes to get identical output - $parser->mUniqPrefix = $this->dtUniqPrefix; + if ( !isset( $this->dtUniqPrefix ) ) { + $this->dtUniqPrefix = $parser->mUniqPrefix; + } else { + $parser->mUniqPrefix = $this->dtUniqPrefix; + } return true; } } -- 2.20.1