X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ftitle%2FMediaWikiTitleCodec.php;h=efc0fd4a71977a61f7f32d924e9dbdda4cd1ed1a;hb=f8e202e0fbd62ac26cfa9ae2695ebc081b08226f;hp=7a71714bca08de9605b9c6297aed54dca86a3ada;hpb=c584722cc2e3d33edae58d46c2149063b3fc6d72;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/MediaWikiTitleCodec.php b/includes/title/MediaWikiTitleCodec.php index 7a71714bca..efc0fd4a71 100644 --- a/includes/title/MediaWikiTitleCodec.php +++ b/includes/title/MediaWikiTitleCodec.php @@ -86,7 +86,6 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { if ( $this->language->needsGenderDistinction() && MWNamespace::hasGenderDistinction( $namespace ) ) { - // NOTE: we are assuming here that the title text is a user name! $gender = $this->genderCache->getGenderOf( $text, __METHOD__ ); $name = $this->language->getGenderNsText( $namespace, $gender ); @@ -302,7 +301,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { # Initial colon indicates main namespace rather than specified default # but should not create invalid {ns,title} pairs such as {0,Project:Foo} - if ( $dbkey !== '' && ':' == $dbkey[0] ) { + if ( $dbkey !== '' && $dbkey[0] == ':' ) { $parts['namespace'] = NS_MAIN; $dbkey = substr( $dbkey, 1 ); # remove the colon but continue processing $dbkey = trim( $dbkey, '_' ); # remove any subsequent whitespace @@ -329,7 +328,6 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { # Disallow Talk:File:x type titles... throw new MalformedTitleException( 'title-invalid-talk-namespace', $text ); } elseif ( $this->interwikiLookup->isValidInterwiki( $x[1] ) ) { - // TODO: get rid of global state! # Disallow Talk:Interwiki:x type titles... throw new MalformedTitleException( 'title-invalid-talk-namespace', $text ); } @@ -369,6 +367,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { if ( $dbkey !== '' && $dbkey[0] == ':' ) { $parts['namespace'] = NS_MAIN; $dbkey = substr( $dbkey, 1 ); + $dbkey = trim( $dbkey, '_' ); } } # If there's no recognized interwiki or namespace,