[Mediawiki-l] Leading/Trailing Underscores in Usernames

Joshua Yeidel yeidel at wsu.edu
Fri Mar 24 00:18:22 UTC 2006

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

        # 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

More information about the MediaWiki-l mailing list