Follow r69904. Make Parser::getRandomString real private.
authorPlatonides <platonides@users.mediawiki.org>
Fri, 15 Oct 2010 22:12:19 +0000 (22:12 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Fri, 15 Oct 2010 22:12:19 +0000 (22:12 +0000)
Parser_DiffTest::dtUniqPrefix is now lazyloader.
I also fixed the typo in its declaration.

includes/parser/Parser.php
includes/parser/Parser_DiffTest.php

index 26be8b9..fe6dbfb 100644 (file)
@@ -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 ) );
        }
 
index b6a7367..ef98fe0 100644 (file)
@@ -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;
        }
 }