From: Brion Vibber Date: Wed, 9 Nov 2005 07:56:39 +0000 (+0000) Subject: * Forbid usernames that can be interpreted as titles with namespaces, as that leads... X-Git-Tag: 1.6.0~1205 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=7c82730aa2ff685712718c54cb1920cb7738e53a;p=lhc%2Fweb%2Fwiklou.git * Forbid usernames that can be interpreted as titles with namespaces, as that leads to hard-to-manage names. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8dc3a02f9e..54fd1e91b7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -214,6 +214,8 @@ fully support the editing toolbar, but was found to be too confusing. localizable as 'datedefault' message. Tweaked lots of languages files... * Added local message cache feature ($wgLocalMessageCache), to reduce bandwidth requirements to the memcached server. +* Forbid usernames that can be interpreted as titles with namespaces, as that + leads to hard-to-manage names. === Caveats === diff --git a/includes/User.php b/includes/User.php index 5f570f40d3..1e3809d141 100644 --- a/includes/User.php +++ b/includes/User.php @@ -201,6 +201,14 @@ class User { || strlen( $name ) > $wgMaxNameChars || $name != $wgContLang->ucfirst( $name ) ) return false; + + // Ensure that the name can't be misresolved as a different title, + // such as with extra namespace keys at the start. + $parsed = Title::newFromText( $name ); + if( is_null( $parsed ) + || $parsed->getNamespace() + || strcmp( $name, $parsed->getPrefixedText() ) ) + return false; else return true; }