Add OutputPage::wrapWikiTextAsInterface() to safely wrap wikitext
authorC. Scott Ananian <cscott@cscott.net>
Thu, 27 Sep 2018 15:04:45 +0000 (11:04 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Wed, 17 Oct 2018 03:39:43 +0000 (23:39 -0400)
commitd404b76510057c3fc4151f51bf6630ae27f6a57b
tree28f46e982fa65cc489e4c75334ee82de7dd9ebd2
parent50d87ad2f809f9052fce4a18b02e0ddb7a58aec9
Add OutputPage::wrapWikiTextAsInterface() to safely wrap wikitext

This patch introduces a new method,
OutputPage::wrapWikiTextAsInterface(), which wraps the result of
OutputPage::addWikiTextAsInterface() in a tidy and robust way that
won't break if the wrapped message contains double newlines, extra
</div>, or other nasties.

This replaces a common unsafe pattern:
  $output->addWikiText( '<div class="..."' .... '</div>' );

Bug: T205624
Change-Id: I1040c7cf0ec1f5c4bef7c06d4486f50d85f2dc0f
includes/OutputPage.php
tests/phpunit/includes/OutputPageTest.php