From fe2e8795d74bf1314dabc07f5cd0f49c70dbf4f6 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 3 Jul 2019 17:28:07 -0700 Subject: [PATCH] Follow-up 9c9cfa2ec3d7: fix non-session entry point error Even though we shouldn't really need to, we have to set the language on the RawMessage we generate when the tag message doesn't exist. Because both MessageLocalizer and RawMessage are kind of hacky and not fully supported, I had to hack around the various gaps in our infrastructure. See my comment on the task for details. Bug: T227233 Change-Id: I5ab3e9b1e8d34b1af531dba33b2f92fcd7f12192 --- includes/changetags/ChangeTags.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 14b53d3093..40f7180579 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -149,7 +149,13 @@ class ChangeTags { $msg = $context->msg( "tag-$tag" ); if ( !$msg->exists() ) { // No such message - return new RawMessage( '$1', [ Message::plaintextParam( $tag ) ] ); + return ( new RawMessage( '$1', [ Message::plaintextParam( $tag ) ] ) ) + // HACK MessageLocalizer doesn't have a way to set the right language on a RawMessage, + // so extract the language from $msg and use that. + // The language doesn't really matter, but we need to set it to avoid requesting + // the user's language from session-less entry points (T227233) + ->inLanguage( $msg->getLanguage() ); + } if ( $msg->isDisabled() ) { // The message exists but is disabled, hide the tag. -- 2.20.1