What is the problem?
When a user's language is different from the wiki's default language and they have a proxy or DNS block against them, they may see (see reprod. steps below):
Fatal exception of type "InvalidArgumentException"
(full exception below)
I think what is happening is:
- when we instantiate the system block we set the "blocker" to be a localised string based on the user's language (here and here)
- when checking if the blocker's name is valid, we compare to a list of $wgReservedUsernames which are localised based on the wiki's language (here)
- where the wiki's and user's translations of the strings differ, the strings don't match and we see the exception
Full stack trace:
[exception] [b158ac783c872a375d731a51] /core/index.php?title=Main_Page&action=edit InvalidArgumentException from line 491 of /var/www/html/core/includes/block/AbstractBlock.php: Blocker must be a local user or a name that cannot be a local user
#0 /var/www/html/core/includes/block/AbstractBlock.php(105): MediaWiki\Block\AbstractBlock->setBlocker(User)
#1 /var/www/html/core/includes/block/SystemBlock.php(49): MediaWiki\Block\AbstractBlock->__construct(array)
#2 /var/www/html/core/includes/block/BlockManager.php(136): MediaWiki\Block\SystemBlock->__construct(array)
#3 /var/www/html/core/includes/user/User.php(1763): MediaWiki\Block\BlockManager->getUserBlock(User, boolean)
#4 /var/www/html/core/includes/user/User.php(2090): User->getBlockedStatus(boolean)
#5 /var/www/html/core/includes/Permissions/PermissionManager.php(635): User->getBlock(boolean)
#6 /var/www/html/core/includes/Permissions/PermissionManager.php(375): MediaWiki\Permissions\PermissionManager->checkUserBlock(string, User, array, string, boolean, Title)
#7 /var/www/html/core/includes/Permissions/PermissionManager.php(258): MediaWiki\Permissions\PermissionManager->getPermissionErrorsInternal(string, User, Title, string)
#8 /var/www/html/core/includes/Title.php(2294): MediaWiki\Permissions\PermissionManager->getPermissionErrors(string, User, Title, string, array)
#9 /var/www/html/core/includes/EditPage.php(715): Title->getUserPermissionsErrors(string, User, string)
#10 /var/www/html/core/includes/EditPage.php(619): EditPage->getEditPermissionErrors(string)
#11 /var/www/html/core/includes/actions/EditAction.php(55): EditPage->edit()
#12 /var/www/html/core/includes/MediaWiki.php(499): EditAction->show()
#13 /var/www/html/core/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#14 /var/www/html/core/includes/MediaWiki.php(884): MediaWiki->performRequest()
#15 /var/www/html/core/includes/MediaWiki.php(515): MediaWiki->main()
#16 /var/www/html/core/index.php(42): MediaWiki->run()
#17 {main}This has the same exception as T192964, but I think they might have different causes. T192964 involves database blocks, whereas I have only been able to reproduce my bug with system blocks.
Steps to reproduce problem
Here are several examples:
Example one
- In LocalSettings.php: $wgLanguageCode = "en"; $wgProxyList = [ '$ip' ];
- From $ip, navigate to /wiki/index.php?title=Main_Page&action=edit&uselang=hsb
Example two
- In LocalSettings.php: $wgLanguageCode = "en"; $wgProxyList = [ '$ip' ];
- Login from $ip as a user whose language is "fr"
Example three
- In LocalSettings.php: $wgLanguageCode = "en"; $wgEnableDnsBlacklist = true; $wgDnsBlacklistUrls = [ 'xip.io.' ];
- From $ip, navigate to /wiki/index.php?title=Main_Page&action=edit&uselang=hsb
Expected behavior: Page will load; You will see a block message.
Observed behavior: Fatal exception of type "InvalidArgumentException"
It should be noted that not all languages are effected on all wikis. For example, many languages use the same translation of 'sorbs', or have no translation of 'proxyblocker' and fallback to en (on an en wiki, presumably).
Environment
Operating system: Debian Stretch
Wiki(s): 1.32.1 and 1.34.0-alpha (c92d559)