From: Roan Kattouw Date: Wed, 6 Aug 2008 20:33:45 +0000 (+0000) Subject: * (bug 15053) Syntactically incorrect redirects with another link in them no longer... X-Git-Tag: 1.31.0-rc.0~46070 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=0aac766f89928ee7054035e8feed780d32e387ca;p=lhc%2Fweb%2Fwiklou.git * (bug 15053) Syntactically incorrect redirects with another link in them no longer redirect to the second link --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 962312c5e9..94c0536bef 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -60,6 +60,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 14972) Use localized alias of Special:Search on all search forms * (bug 11035) Special:Search should have descriptive * Special pages are now not subject to special handling for "self-links" +* (bug 15053) Syntactically incorrect redirects with another link in them + no longer redirect to the second link === API changes in 1.14 === diff --git a/includes/Title.php b/includes/Title.php index 55d846184d..e3124d58dc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -296,10 +296,12 @@ class Title { */ public static function newFromRedirect( $text ) { $redir = MagicWord::get( 'redirect' ); - if( $redir->matchStart( trim($text) ) ) { + $text = trim($text); + if( $redir->matchStartAndRemove( $text ) ) { // Extract the first link and see if it's usable + // Ensure that it really does come directly after #REDIRECT $m = array(); - if( preg_match( '!\[{2}(.*?)(?:\|.*?)?\]{2}!', $text, $m ) ) { + if( preg_match( '!^\s*\[{2}(.*?)(?:\|.*?)?\]{2}!', $text, $m ) ) { // Strip preceding colon used to "escape" categories, etc. // and URL-decode links if( strpos( $m[1], '%' ) !== false ) {