From: Conrad Irwin Date: Thu, 15 Apr 2010 22:41:49 +0000 (+0000) Subject: Put a 235 byte limit on usernames to allow /thelongskinname.css to work (bug 23080) X-Git-Tag: 1.31.0-rc.0~37097 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=7b29f47a8e18818db0c12dd37455a8df64d6835c;p=lhc%2Fweb%2Fwiklou.git Put a 235 byte limit on usernames to allow /thelongskinname.css to work (bug 23080) --- diff --git a/includes/User.php b/includes/User.php index 227e36af61..275800f806 100644 --- a/includes/User.php +++ b/includes/User.php @@ -599,20 +599,31 @@ class User { * either by batch processes or by user accounts which have * already been created. * - * Additional character blacklisting may be added here - * rather than in isValidUserName() to avoid disrupting - * existing accounts. + * Additional blacklisting may be added here rather than in + * isValidUserName() to avoid disrupting existing accounts. * * @param $name \string String to match * @return \bool True or false */ static function isCreatableName( $name ) { global $wgInvalidUsernameCharacters; - return - self::isUsableName( $name ) && - // Registration-time character blacklisting... - !preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name ); + // Ensure that the username isn't longer than 235 bytes, so that + // (at least for the builtin skins) user javascript and css files + // will work. (bug 23080) + if( strlen( $name ) > 235 ) { + wfDebugLog( 'username', __METHOD__ . + ": '$name' invalid due to length" ); + return false; + } + + if( preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name ) ) { + wfDebugLog( 'username', __METHOD__ . + ": '$name' invalid due to wgInvalidUsernameCharacters" ); + return false; + } + + return self::isUsableName( $name ); } /**