Leading/Trailing Underscores in Usernames

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Leading/Trailing Underscores in Usernames

Joshua Yeidel
Usernames are transformed into Title objects as part of the signon process.
I presume this is to ensure that "User:username" makes a valid page title.

As part of that process, it appears to me from ll. 1276-1279 in Title.php
that leading and trailing underscores are prevented from being in MediaWiki
usernames:

        # Clean up whitespace
        #
        $t = preg_replace( '/[ _]+/', '_', $this->mDbkeyform );
        $t = trim( $t, '_' );


We are doing authentication via an external university-wide Active Directory
system. Though we now do not permit new usernames which begin with "_",
there are 2 legacy names which do.  We also have 38 usernames which have
trailing "_".  [What possesses people to do this is beyond me, but that's
beside the point.]

Does anyone know of dire consequences if I replaces the lines above with
something like:

    $t = trim ($this->mDbkeyform);
    $t = strtr(t$,' ','_');

This would trim leading and trailing spaces, and convert embedded spaces to
underscores, but leave leading and trailing underscores untouched.

Thanks for any thoughts...

-- Joshua



_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l