From: Roan Kattouw Date: Thu, 4 Jul 2019 00:28:07 +0000 (-0700) Subject: Follow-up 9c9cfa2ec3d7: fix non-session entry point error X-Git-Tag: 1.34.0-rc.0~1158^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=fe2e8795d74bf1314dabc07f5cd0f49c70dbf4f6;p=lhc%2Fweb%2Fwiklou.git 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 --- 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.