Revert breakage in secureAndSplit() which failed to remove head/trail
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 9 Apr 2004 00:45:15 +0000 (00:45 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 9 Apr 2004 00:45:15 +0000 (00:45 +0000)
whitespace if provided as underlines.

includes/Title.php

index 365378e..18bec83 100644 (file)
@@ -601,7 +601,15 @@ class Title {
 
                # Clean up whitespace
                #
-               $t = preg_replace( "/[\\s_]+/", "_", trim($this->mDbkeyform) );
+               $t = preg_replace( "/[\\s_]+/", "_", $this->mDbkeyform );
+               if ( "_" == @$t{0} ) { 
+                       $t = substr( $t, 1 ); 
+               }
+               $l = strlen( $t );
+               if ( $l && ( "_" == $t{$l-1} ) ) { 
+                       $t = substr( $t, 0, $l-1 ); 
+               }
+
                if ( "" == $t ) {
                        wfProfileOut( $fname );
                        return false;