From 4f269d67b8b4d2826987a546f1afa64a11fba6b3 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 23 May 2020 23:49:32 +0200 Subject: [PATCH] Explicitly format Message oject instead of string cast The implicit in Mesage::__toString, as called when the object is accepted by a method that needs a string, is to format with parse(). Call that explicitly instead, or use escaped() in places where it seems like elaborate wikitext isn't expected. Change-Id: I9f1de3a0047d1f26d30c8607a0a79543d166176f --- includes/Menu/PageActions/ToolbarBuilder.php | 4 ++-- includes/MinervaHooks.php | 2 +- includes/Skins/MinervaTemplate.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/Menu/PageActions/ToolbarBuilder.php b/includes/Menu/PageActions/ToolbarBuilder.php index 311cddec5..288b52e31 100644 --- a/includes/Menu/PageActions/ToolbarBuilder.php +++ b/includes/Menu/PageActions/ToolbarBuilder.php @@ -163,7 +163,7 @@ class ToolbarBuilder { $entry = new SingleMenuEntry( 'page-actions-contributions', - $label, + $label->escaped(), SpecialPage::getTitleFor( 'Contributions', $user->getName() )->getLocalURL() ); $entry->setTitle( $label ) ->trackClicks( 'contributions' ) @@ -199,7 +199,7 @@ class ToolbarBuilder { $entry = new SingleMenuEntry( 'page-actions-edit', - $this->messageLocalizer->msg( 'mobile-frontend-editor-edit' ), + $this->messageLocalizer->msg( 'mobile-frontend-editor-edit' )->escaped(), $title->getLocalURL( $editArgs ), 'edit-page' ); diff --git a/includes/MinervaHooks.php b/includes/MinervaHooks.php index 49dc5e896..aaa8e0324 100644 --- a/includes/MinervaHooks.php +++ b/includes/MinervaHooks.php @@ -175,7 +175,7 @@ class MinervaHooks { $enhanced = $request->getBool( 'enhanced', $isEnhancedDefaultForUser ); if ( $enhanced ) { $out->addHTML( Html::warningBox( - $special->msg( 'skin-minerva-recentchanges-warning-enhanced-not-supported' ) + $special->msg( 'skin-minerva-recentchanges-warning-enhanced-not-supported' )->parse() ) ); } break; diff --git a/includes/Skins/MinervaTemplate.php b/includes/Skins/MinervaTemplate.php index c10c84ffc..16f290bd9 100644 --- a/includes/Skins/MinervaTemplate.php +++ b/includes/Skins/MinervaTemplate.php @@ -257,7 +257,7 @@ class MinervaTemplate extends BaseTemplate { 'class' => MinervaUI::iconClass( 'search-base20', 'element', 'skin-minerva-search-trigger', 'wikimedia' ) - ], wfMessage( 'searchbutton' ) ), + ], wfMessage( 'searchbutton' )->escaped() ), 'userNotificationsHTML' => $data['userNotificationsHTML'] ?? '', 'data-main-menu' => $this->getMainMenuData( $data ), 'hasheadingholder' => $hasHeadingHolder,