Last modified: 2013-01-14 17:10:23 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T42162, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40162 - [[|page]] style context link may forget to include namespace name
[[|page]] style context link may forget to include namespace name
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-11 12:01 UTC by Liangent
Modified: 2013-01-14 17:10 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Liangent 2012-09-11 12:01:43 UTC
Code says:

                # Context links: [[|name]] and [[name (context)|]]
                $tc = '[' . Title::legalChars() . ']';
                $nc = '[ _0-9A-Za-z\x80-\xff-]'; # Namespaces can use non-ascii!

                # ... omitted ...

                $t = $this->mTitle->getText();
                $m = array();
                if ( preg_match( "/^($nc+:|)$tc+?( \\($tc+\\))$/", $t, $m ) ) {
                        $text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]", $text );
                } elseif ( preg_match( "/^($nc+:|)$tc+?(, $tc+|)$/", $t, $m ) && "$m[1]$m[2]" != '' ) {
                        $text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]", $text );
                } else {
                        # if there's no context, don't bother duplicating the title
                        $text = preg_replace( $p2, '[[\\1]]', $text );
                }

In 'if' and 'elseif' line, regexes begins with ($nc+:|) so I guess the original author intended to include namespace name automatically, but $t = $this->mTitle->getText(); should be written as $t = $this->mTitle->getPrefixedText(); in this case.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links