https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111898

Revision: 111898
Author:   dantman
Date:     2012-02-19 23:40:48 +0000 (Sun, 19 Feb 2012)
Log Message:
-----------
Followup r111891; Base the $staticInitialised variable off of the global setup 
so that the parser test suite is not royally screwed up by the fact that it 
sets globals for parsing AFTER already executing parsing code based off of 
different globals.

Modified Paths:
--------------
    trunk/phase3/includes/Sanitizer.php

Modified: trunk/phase3/includes/Sanitizer.php
===================================================================
--- trunk/phase3/includes/Sanitizer.php 2012-02-19 23:40:02 UTC (rev 111897)
+++ trunk/phase3/includes/Sanitizer.php 2012-02-19 23:40:48 UTC (rev 111898)
@@ -364,14 +364,17 @@
         * @return string
         */
        static function removeHTMLtags( $text, $processCallback = null, $args = 
array(), $extratags = array(), $removetags = array() ) {
-               global $wgUseTidy, $wgHtml5, $wgAllowMicrodataAttributes;
+               global $wgUseTidy, $wgHtml5, $wgAllowMicrodataAttributes, 
$wgAllowImageTag;
 
                static $htmlpairsStatic, $htmlsingle, $htmlsingleonly, 
$htmlnest, $tabletags,
                        $htmllist, $listtags, $htmlsingleallowed, 
$htmlelementsStatic, $staticInitialised;
 
                wfProfileIn( __METHOD__ );
 
-               if ( !$staticInitialised ) {
+               // Base our staticInitialised variable off of the global config 
state so that if the globals
+               // are changed (like in the secrewed up test system) we will 
re-initialise the settings.
+               $globalContext = implode( '-', compact( 'wgHtml5', 
'wgAllowMicrodataAttributes', 'wgAllowImageTag' ) );
+               if ( !$staticInitialised || $staticInitialised != 
$globalContext ) {
 
                        $htmlpairsStatic = array( # Tags that must be closed
                                'b', 'del', 'i', 'ins', 'u', 'font', 'big', 
'small', 'sub', 'sup', 'h1',
@@ -408,7 +411,6 @@
                                'li',
                        );
 
-                       global $wgAllowImageTag;
                        if ( $wgAllowImageTag ) {
                                $htmlsingle[] = 'img';
                                $htmlsingleonly[] = 'img';
@@ -423,7 +425,7 @@
                        foreach ( $vars as $var ) {
                                $$var = array_flip( $$var );
                        }
-                       $staticInitialised = true;
+                       $staticInitialised = $globalContext;
                }
                # Populate $htmlpairs and $htmlelements with the $extratags and 
$removetags arrays
                $extratags = array_flip( $extratags );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to