From: Brion Vibber Date: Thu, 11 Dec 2003 12:43:13 +0000 (+0000) Subject: Fix for #837969. Strict rejection of invalid characters in titles is good practice... X-Git-Tag: 1.3.0beta1~1260 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=20ea17594b20c9b9481e94b6e20cff54912f91a9;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );