From: Bartosz DziewoƄski Date: Fri, 9 May 2014 22:44:05 +0000 (+0200) Subject: SpecialUserlogin: Error out when attempting to create a username with a '#' X-Git-Tag: 1.31.0-rc.0~15815^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=2cf4879b209f764d25e7de9bef1573a6d90c1c3c;p=lhc%2Fweb%2Fwiklou.git SpecialUserlogin: Error out when attempting to create a username with a '#' "Best practices"? Ain't never heard of it. Bug: 64960 Change-Id: I88c479cea2bc9d2eab882e0ee8ebcbe2d1dd125e --- diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 4006e49bfc..5ce28126d8 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -435,7 +435,11 @@ class LoginForm extends SpecialPage { // Normalize the name so that silly things don't cause "invalid username" // errors. User::newFromName does some rather strict checking, rejecting - // e.g. leading/trailing/multiple spaces. + // e.g. leading/trailing/multiple spaces. But first we need to reject + // usernames that would be treated as titles with a fragment part. + if ( strpos( $this->mUsername, '#' ) !== false ) { + return Status::newFatal( 'noname' ); + } $title = Title::makeTitleSafe( NS_USER, $this->mUsername ); if ( !is_object( $title ) ) { return Status::newFatal( 'noname' );