From: Tim Starling Date: Thu, 7 Jul 2016 23:42:50 +0000 (+1000) Subject: Don't run the non-Tidy "bug 2702" hack unless Tidy is really missing X-Git-Tag: 1.31.0-rc.0~6243^2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=134f8c451323663c466d985823effeec585d4e8f;hp=a4d737f22942d71252ad78e18d0221a581ed455e;p=lhc%2Fweb%2Fwiklou.git Don't run the non-Tidy "bug 2702" hack unless Tidy is really missing We have two hacks which are used when Tidy is not available: one in Sanitizer::removeHTMLtags(), and the second here as a late Parser pass equivalent to Tidy itself. But the Sanitizer one was enabled only if MWTidy::isEnabled() returned false, whereas the Parser one was enabled also when tidy was disabled in ParserOptions. This patch makes them both consistent, it enables the bug 2702 hack only when MWTidy::isEnabled() returns false, and when Tidy is disabled in parser options, the output is simply passed through. This allows tidying to be done separately on the ParserOutput, as is required by the proposed ParserMigration extension (I24d0776a933fa3f). Eventually the bug 2702 hack will be removed in favour of a pure-PHP HTML 5 parser, but it looks like it is too early for that. Change-Id: I94be6c9dec531c23ef80cb36732243bd6858bf22 --- diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28 index 608bc56da4..5b77ac2112 100644 --- a/RELEASE-NOTES-1.28 +++ b/RELEASE-NOTES-1.28 @@ -85,6 +85,8 @@ changes to languages because of Phabricator reports. were replaced by HtmlPageLinkRendererBegin and HtmlPageLinkRendererEnd respectively. See docs/hooks.txt for the specific changes needed for those hooks. * The 'ParserLimitReportFormat' hook was removed. +* Disabled "bug 2702" HTML tidying of parsed UI messages on wikis where Tidy is + disabled. == Compatibility == diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e57ec8ec49..f9eea48798 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1341,8 +1341,10 @@ class Parser { $text = Sanitizer::normalizeCharReferences( $text ); - if ( MWTidy::isEnabled() && $this->mOptions->getTidy() ) { - $text = MWTidy::tidy( $text ); + if ( MWTidy::isEnabled() ) { + if ( $this->mOptions->getTidy() ) { + $text = MWTidy::tidy( $text ); + } } else { # attempt to sanitize at least some nesting problems # (bug #2702 and quite a few others)