From 2cf4879b209f764d25e7de9bef1573a6d90c1c3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Sat, 10 May 2014 00:44:05 +0200 Subject: [PATCH] SpecialUserlogin: Error out when attempting to create a username with a '#' "Best practices"? Ain't never heard of it. Bug: 64960 Change-Id: I88c479cea2bc9d2eab882e0ee8ebcbe2d1dd125e --- includes/specials/SpecialUserlogin.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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' ); -- 2.20.1