From 734fa7a9c038bc4107e033f56b0261cc46a50aa4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 23 Dec 2006 00:28:48 +0000 Subject: [PATCH] * (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. --- RELEASE-NOTES | 6 +++++- includes/Title.php | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 68a3ed039a..9e64ec2f97 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 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 == diff --git a/includes/Title.php b/includes/Title.php index e1ee2ac629..a2cf380ce1 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ) { -- 2.20.1