From 8dfb5c2e2390014bb652949c2e136e6b2d1d455a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 23 Aug 2009 00:45:36 +0000 Subject: [PATCH] * (bug 11143) Links containing invalid UTF-8 percent-code sequences are now cleanly disabled instead of breaking parsing entirely on PHP 5.2. This was fixed as a side-effect of r55382 for bug 15248; adding comments in Title::secureAndSplit nothing this. --- RELEASE-NOTES | 2 ++ includes/Title.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 47dce9afb8..dc333bf638 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -412,6 +412,8 @@ this. Was used when mwEmbed was going to be an extension. * (bug 15248) Non-breaking spaces and certain other Unicode space characters are now normalized to ordinary spaces in titles; if your wiki has existing titles with such characters, run cleanupTitles.php and/or cleanupImages.php +* (bug 11143) Links containing invalid UTF-8 percent-code sequences are now + cleanly disabled instead of breaking parsing entirely on PHP 5.2. * (bug 20296) Fixed an PHP warning in Language::getMagic() in PHP 5.3 * When creating accounts, don't prefill name from current username (which presumably is already taken) diff --git a/includes/Title.php b/includes/Title.php index 51a9c17ea0..d65e2aca72 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2241,6 +2241,9 @@ class Title { $dbkey = preg_replace( '/\xE2\x80[\x8E\x8F\xAA-\xAE]/S', '', $dbkey ); # Clean up whitespace + # Note: use of the /u option on preg_replace here will cause + # input with invalid UTF-8 sequences to be nullified out in PHP 5.2.x, + # conveniently disabling them. # $dbkey = preg_replace( '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200B}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u', '_', $dbkey ); $dbkey = trim( $dbkey, '_' ); -- 2.20.1