From a3a2744d033c41a0456d495f6a0fb5e8165224bf Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 28 Dec 2007 21:34:49 +0000 Subject: [PATCH] * (bug 3097) Inconsistently usable titles containing HTML character entities are now forbidden. A run of cleanupTitles.php will fix up existing pages. --- RELEASE-NOTES | 2 ++ includes/Title.php | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6a43665a5e..5e80096150 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -270,6 +270,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 8066) Spaces can't be entered in special page aliases * Hide undo link if user can't edit article * (bug 12416) Fix password setting for createAndPromote.php +* (bug 3097) Inconsistently usable titles containing HTML character entities + are now forbidden. A run of cleanupTitles.php will fix up existing pages. == Parser changes in 1.12 == diff --git a/includes/Title.php b/includes/Title.php index 2225aa358e..c78870762c 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1894,8 +1894,18 @@ class Title { # Initialisation static $rxTc = false; if( !$rxTc ) { - # % is needed as well - $rxTc = '/[^' . Title::legalChars() . ']|%[0-9A-Fa-f]{2}/S'; + # Matching titles will be held as illegal. + $rxTc = '/' . + # Any character not allowed is forbidden... + '[^' . Title::legalChars() . ']' . + # URL percent encoding sequences interfere with the ability + # to round-trip titles -- you can't link to them consistently. + '|%[0-9A-Fa-f]{2}' . + # XML/HTML character references produce similar issues. + '|&[A-Za-z0-9\x80-\xff]+;' . + '|&#[0-9]+;' . + '|&#x[0-9A-Fa-f]+;' . + '/S'; } $this->mInterwiki = $this->mFragment = ''; -- 2.20.1