http://www.mediawiki.org/wiki/Special:Code/MediaWiki/55514

Revision: 55514
Author:   brion
Date:     2009-08-23 00:45:36 +0000 (Sun, 23 Aug 2009)

Log Message:
-----------
* (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.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/includes/Title.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2009-08-23 00:14:03 UTC (rev 55513)
+++ trunk/phase3/RELEASE-NOTES  2009-08-23 00:45:36 UTC (rev 55514)
@@ -412,6 +412,8 @@
 * (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)

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     2009-08-23 00:14:03 UTC (rev 55513)
+++ trunk/phase3/includes/Title.php     2009-08-23 00:45:36 UTC (rev 55514)
@@ -2241,6 +2241,9 @@
                $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, '_' );



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to