Allow leading whitespace in redirect matches (bug 13344)
[lhc/web/wiklou.git] / includes / Title.php
index d6d763b..c07518a 100644 (file)
@@ -285,7 +285,7 @@ class Title {
         */
        public static function newFromRedirect( $text ) {
                $redir = MagicWord::get( 'redirect' );
-               if( $redir->matchStart( $text ) ) {
+               if( $redir->matchStart( trim($text) ) ) {
                        // Extract the first link and see if it's usable
                        $m = array();
                        if( preg_match( '!\[{2}(.*?)(?:\||\]{2})!', $text, $m ) ) {