Page MenuHomePhabricator

"blockedtext" message uses user id instead of username for numerical usernames
Closed, ResolvedPublic

Description

In MediaWiki messages that display usernames, if the parameter input is numerical, the software assumes that it must be a user id. This breaks the message for users with purely numerical usernames.

This bug came to light after [[User:7]] on the English Wikipedia blocked themselves for April Fools, but the blocking user was displayed as [[User:Joao]] (user id 7). See the following:

https://en.wikipedia.org/wiki/MediaWiki_talk:Blockedtext#.241_variable_is_not_working
https://en.wikipedia.org/wiki/File:Blocked_Media_Wiki_Parameter_Problem.png


Version: 1.22.0
Severity: normal

Details

Reference
bz46768

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:34 AM
bzimport set Reference to bz46768.

Given https://test.wikipedia.org/w/api.php?action=query&list=allusers&aufrom=Jimbo+Wales&aulimit=1 (<u userid="6295" name="Jimbo Wales" />), I created User:6295 on test.wikipedia.org (using an admin account, as a global blacklist rule prevents strictly numeric usernames...). I blocked the account with my main account (User:MZMcBride) and the post-block success screen, Special:Log/block, Special:BlockList, Special:RecentChanges, and the various log excerpts (at Special:Contributions, etc.) all look fine to me.

Special:Watchlist isn't showing the block of User:6295, but I think that's because the user did not yet have a user page (or possibly because the user account name was numeric...). This is a separate issue that I'll investigate elsewhere.

I made User:6295 an admin on test.wikipedia.org and self-blocked. When I visit https://test.wikipedia.org/w/index.php?title=Main_Page&action=edit while logged in as the self-blocked User:6295, I see:


You do not have permission to edit this page, for the following reason:
Your account or IP address has been blocked.

The block was made by Jimbo Wales. The reason given is testing.
Start of block: 04:06, 2 April 2013
Expiry of block: infinite
Intended blockee: 6295

You can contact Jimbo Wales or another administrator to discuss the block. You cannot use the 'e-mail this user' feature unless a valid e-mail address is specified in your account preferences and you have not been blocked from using it. Your current IP address is 68.33.116.129, and the block ID is #15060. Please include all above details in any queries you make.

Marking this bug as _confirmed_ (new) accordingly. (Hah! An April Fools' prank exposes a legitimate user interface bug.) Where the block message reads "Jimbo Wales", it should read "6295". I'm not sure how many MediaWiki messages are affected.

(In reply to comment #1)

Special:Watchlist isn't showing the block of User:6295, but I think that's
because the user did not yet have a user page (or possibly because the user
account name was numeric...). This is a separate issue that I'll investigate
elsewhere.

I filed this as bug 46769.

I'm marking this bug (bug 46768) as easy, as it should be a fairly trivial change.

gerrit 57436 should cover Title::getUserPermissionsErrors().

(In reply to comment #3)

Gerrit change #57436 should cover Title::getUserPermissionsErrors().

Reverted with https://gerrit.wikimedia.org/r/#/c/58283/ since the patch broke unit tests (see bug 47031)

Related URL: https://gerrit.wikimedia.org/r/58308 (Gerrit Change I49d973992a99e03b4e8de112b47b737037a85338)

Should be fixed in 1.22wmf3. Please file separate reports for any similar
issues that are not related to the "blockedtext" and "autoblockedtext"
messages.