From 20ea17594b20c9b9481e94b6e20cff54912f91a9 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 11 Dec 2003 12:43:13 +0000 Subject: [PATCH] Fix for #837969. Strict rejection of invalid characters in titles is good practice, and should keep away these problems with broken inaccessible pages created by page moves --- includes/Title.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 7c840b983b..3639be9210 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -401,6 +401,14 @@ class Title { $this->mInterwiki = $this->mFragment = ""; $this->mNamespace = 0; + # Reject illegal characters. + # + if( preg_match( $rxTc, $this->mDbkeyform ) ) { + return false; + } + + # Clean up whitespace + # $t = preg_replace( "/[\\s_]+/", "_", $this->mDbkeyform ); if ( "_" == $t{0} ) { $t = substr( $t, 1 ); @@ -455,10 +463,8 @@ class Title { $this->mFragment = substr( $f, 1 ); $r = substr( $r, 0, strlen( $r ) - strlen( $f ) ); } - # Strip illegal characters. - # - $t = preg_replace( $rxTc, "", $r ); + $t = $r; if( $this->mInterwiki == "") $t = $wgLang->ucfirst( $t ); $this->mDbkeyform = $t; $this->mUrlform = wfUrlencode( $t ); -- 2.20.1