* (bug 3696) Strip LRM and RLM characters from titles to work around the
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 23 Dec 2006 00:28:48 +0000 (00:28 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 23 Dec 2006 00:28:48 +0000 (00:28 +0000)
  problem some people have where titles cut-and-pasted from lists include
  the bidi override characters appended to the lists.
  A more thorough blacklist for forbidden and translatable characters would
  be wise, though, as might a cleaner method for the lists in the first place.

RELEASE-NOTES
includes/Title.php

index 68a3ed0..9e64ec2 100644 (file)
@@ -381,7 +381,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 8231) Gave useful alt text to the main <img> on image pages
 * (bug 371) Remove alt text for "Enlarge" icon on thumbnails
 * Initialize user_editcount to 0 instead of NULL for newly created accounts
-
+* (bug 3696) Strip LRM and RLM characters from titles to work around the
+  problem some people have where titles cut-and-pasted from lists include
+  the bidi override characters appended to the lists.
+  A more thorough blacklist for forbidden and translatable characters would
+  be wise, though, as might a cleaner method for the lists in the first place.
 
 == Languages updated ==
 
index e1ee2ac..a2cf380 100644 (file)
@@ -1477,10 +1477,18 @@ class Title {
 
                $this->mInterwiki = $this->mFragment = '';
                $this->mNamespace = $this->mDefaultNamespace; # Usually NS_MAIN
+               
+               $dbkey = $this->mDbkeyform;
 
+               # Strip Unicode bidi override characters.
+               # Sometimes they slip into cut-n-pasted page titles, where the
+               # override chars get included in list displays.
+               $dbkey = str_replace( "\xE2\x80\x8E", '', $dbkey ); // 200E LEFT-TO-RIGHT MARK
+               $dbkey = str_replace( "\xE2\x80\x8F", '', $dbkey ); // 200F RIGHT-TO-LEFT MARK
+               
                # Clean up whitespace
                #
-               $dbkey = preg_replace( '/[ _]+/', '_', $this->mDbkeyform );
+               $dbkey = preg_replace( '/[ _]+/', '_', $dbkey );
                $dbkey = trim( $dbkey, '_' );
 
                if ( '' == $dbkey ) {