From d8dc024eb406df2d035abd862636cd442a131a83 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2004 00:45:15 +0000 Subject: [PATCH] Revert breakage in secureAndSplit() which failed to remove head/trail whitespace if provided as underlines. --- includes/Title.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/Title.php b/includes/Title.php index 365378e529..18bec83643 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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; -- 2.20.1