Special:EmailUser errors out when viewing the page if the current user has email confirmed but does not have the necessary user right to use the page.
This seems to be because the code in SpecialEmailUser::execute uses a switch to find the permission error message and then display the appropriate message. However, the message key used to indicate a permission error changed from badaccess to badaccess-group0 and badaccess-groups.
Steps to replicate the issue
- Add $wgRevokePermissions['user']['sendemail'] = true; to LocalSettings.php
- Log into an account with a confirmed email address
- Load Special:EmailUser
What happens?:
The page errors out with the following exception:
[181e166129cbb5173a2c2054] /wiki/Special:EmailUser InvalidArgumentException: MediaWiki\Message\Message::newFromSpecifier: invalid argument type NULL Backtrace: from /var/www/html/w/includes/Message/Message.php(467) #0 /var/www/html/w/includes/GlobalFunctions.php(906): MediaWiki\Message\Message::newFromSpecifier() #1 /var/www/html/w/includes/exception/ErrorPageError.php(67): wfMessage() #2 /var/www/html/w/includes/exception/ErrorPageError.php(53): ErrorPageError->getMessageObject() #3 /var/www/html/w/includes/specials/SpecialEmailUser.php(186): ErrorPageError->__construct() #4 /var/www/html/w/includes/specialpage/SpecialPage.php(720): MediaWiki\Specials\SpecialEmailUser->execute() #5 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(1651): MediaWiki\SpecialPage\SpecialPage->run() #6 /var/www/html/w/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath() #7 /var/www/html/w/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest() #8 /var/www/html/w/includes/MediaWikiEntryPoint.php(199): MediaWiki\Actions\ActionEntryPoint->execute() #9 /var/www/html/w/index.php(58): MediaWiki\MediaWikiEntryPoint->run() #10 {main}
What should have happened instead?:
The code should have displayed the PermissionsError error page.
Software version
MediaWiki 1.42.0-alpha (1db03e0) 15:03, 20 March 2024