user: Remove use of Message:text() from User::isUsableName()
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 29 Sep 2018 01:01:55 +0000 (02:01 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 29 Sep 2018 01:09:35 +0000 (02:09 +0100)
None of the current translations use of "&", "{" or "[", which
presumably means they don't require tranformation. I'd also
very much prefer such dynamic constructs not be added into
this system which would make it rather unpredictable given these
reserved usernames shouldn't change from time to time.

The only match for the below command is qqq.json,

> $ git grep -E '"(double-redirect-fixer|usermessage-editor|\
> proxyblocker|sorbs|spambot.username|autochange-username)"\
> ' | grep -E '[{&[]'

This code was originally introduced with r37928 (5ad5cb4f0a64),
which used wfMsgForContent() and made no explicit mention of
transformation, it just happened to be the default. Later, when
that function was deprecated, it got batch-replaced by
->inContentLanguage()->text().

Bug: T189966
Change-Id: Ia4ddf215e83f15de552f8311b9e737559c72b49a

includes/user/User.php

index aaa7663..c9fe959 100644 (file)
@@ -1051,7 +1051,7 @@ class User implements IDBAccessObject, UserIdentity {
                // Certain names may be reserved for batch processes.
                foreach ( $reservedUsernames as $reserved ) {
                        if ( substr( $reserved, 0, 4 ) == 'msg:' ) {
-                               $reserved = wfMessage( substr( $reserved, 4 ) )->inContentLanguage()->text();
+                               $reserved = wfMessage( substr( $reserved, 4 ) )->inContentLanguage()->plain();
                        }
                        if ( $reserved == $name ) {
                                return false;