(bug 6100) Strip Unicode BiDi embedding/override characters (U+202A - U+202E) from...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Thu, 27 Nov 2008 20:11:38 +0000 (20:11 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Thu, 27 Nov 2008 20:11:38 +0000 (20:11 +0000)
NOTE: run maintenance/cleanupImages.php and cleanupTitles.php ASAP after deploying this!

RELEASE-NOTES
includes/Title.php

index f496598..ef0d8bd 100644 (file)
@@ -369,6 +369,10 @@ The following extensions are migrated into MediaWiki 1.14:
 * Honour unchecked "Leave a redirect behind" for moved subpages
 * (bug 16440) Broken 0-byte math renderings are now deleted and re-rendered
   when page is re-parsed.
+* (bug 6100) Unicode BiDi embedding/override characters (U+202A - U+202E) are
+  now automatically removed from titles; these characters can accidentally end
+  up in copy-and-pasted titles, and, by overriding normal bidirectional text
+  handling, can lead to annoying behavior such as text rendering backwards
 
 === API changes in 1.14 ===
 
index aa9a739..88118fd 100644 (file)
@@ -2047,8 +2047,7 @@ class Title {
                # 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
+               $dbkey = preg_replace( '/\xE2\x80[\x8E\x8F\xAA-\xAE]/S', '', $dbkey );
 
                # Clean up whitespace
                #