From: Daniel Friesen Date: Sun, 19 Feb 2012 23:40:48 +0000 (+0000) Subject: Followup r111891; Base the $staticInitialised variable off of the global setup so... X-Git-Tag: 1.31.0-rc.0~24622 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=c040cd75b3626dad9c346975671f94b67b2b3d76;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index cc71902ace..4e38c4f5b1 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -364,14 +364,17 @@ class Sanitizer { * @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 @@ class Sanitizer { 'li', ); - global $wgAllowImageTag; if ( $wgAllowImageTag ) { $htmlsingle[] = 'img'; $htmlsingleonly[] = 'img'; @@ -423,7 +425,7 @@ class Sanitizer { 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 );