jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/382517 )
Change subject: CheckBlocksSecondaryAuthenticationProvider: Avoid user language during auto-creation ...................................................................... CheckBlocksSecondaryAuthenticationProvider: Avoid user language during auto-creation If a user being auto-created is blocked from account creation without a reason given, CheckBlocksPrimaryAuthProvider is triggering a "User::loadFromSession called before the end of Setup.php" log message when trying to fill in a reason using 'blockednoreason'. In this situation, use the content language instead. Bug: T124367 Change-Id: Id94c919cdba5e4218b709ba8ac9d0fa17f0c3f8e --- M includes/auth/CheckBlocksSecondaryAuthenticationProvider.php 1 file changed, 11 insertions(+), 1 deletion(-) Approvals: Gergő Tisza: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php b/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php index f7a7ec1..7488fba 100644 --- a/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php +++ b/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php @@ -77,9 +77,19 @@ public function testUserForCreation( $user, $autocreate, array $options = [] ) { $block = $user->isBlockedFromCreateAccount(); if ( $block ) { + if ( $block->mReason ) { + $reason = $block->mReason; + } else { + $msg = \Message::newFromKey( 'blockednoreason' ); + if ( !\RequestContext::getMain()->getUser()->isSafeToLoad() ) { + $msg->inContentLanguage(); + } + $reason = $msg->text(); + } + $errorParams = [ $block->getTarget(), - $block->mReason ?: \Message::newFromKey( 'blockednoreason' )->text(), + $reason, $block->getByName() ]; -- To view, visit https://gerrit.wikimedia.org/r/382517 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id94c919cdba5e4218b709ba8ac9d0fa17f0c3f8e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits