r65101 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65100‎ | r65101 | r65102 >
Date:22:41, 15 April 2010
Author:conrad
Status:ok
Tags:
Comment:
Put a 235 byte limit on usernames to allow /thelongskinname.css to work (bug 23080)
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -599,20 +599,31 @@
600600 * either by batch processes or by user accounts which have
601601 * already been created.
602602 *
603 - * Additional character blacklisting may be added here
604 - * rather than in isValidUserName() to avoid disrupting
605 - * existing accounts.
 603+ * Additional blacklisting may be added here rather than in
 604+ * isValidUserName() to avoid disrupting existing accounts.
606605 *
607606 * @param $name \string String to match
608607 * @return \bool True or false
609608 */
610609 static function isCreatableName( $name ) {
611610 global $wgInvalidUsernameCharacters;
612 - return
613 - self::isUsableName( $name ) &&
614611
615 - // Registration-time character blacklisting...
616 - !preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name );
 612+ // Ensure that the username isn't longer than 235 bytes, so that
 613+ // (at least for the builtin skins) user javascript and css files
 614+ // will work. (bug 23080)
 615+ if( strlen( $name ) > 235 ) {
 616+ wfDebugLog( 'username', __METHOD__ .
 617+ ": '$name' invalid due to length" );
 618+ return false;
 619+ }
 620+
 621+ if( preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name ) ) {
 622+ wfDebugLog( 'username', __METHOD__ .
 623+ ": '$name' invalid due to wgInvalidUsernameCharacters" );
 624+ return false;
 625+ }
 626+
 627+ return self::isUsableName( $name );
617628 }
618629
619630 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r65102RELEASE-NOTES for r65101conrad22:43, 15 April 2010

Status & tagging log