Last modified: 2011-04-30 01:21:41 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 T24940, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22940 - Cannot create namespace alias to NS_MAIN
Cannot create namespace alias to NS_MAIN
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.15.x
All Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 23842 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-25 14:53 UTC by quietust
Modified: 2011-04-30 01:21 UTC (History)
2 users (show)

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


Attachments

Description quietust 2010-03-25 14:53:55 UTC
Attempting to create a namespace alias which links to NS_MAIN results in the entry being completely ignored. Aliases to other namespaces work just fine.

I was able to solve this problem by editing the function Title::secureAndSplit() as follows:

			$m = array();
			if ( preg_match( $prefixRegexp, $dbkey, $m ) ) {
				$p = $m[1];
-				if ( $ns = $wgContLang->getNsIndex( $p ) ) {
+				if (( $ns = $wgContLang->getNsIndex( $p ) ) !== false) {
					# Ordinary namespace
					$dbkey = $m[2];
					$this->mNamespace = $ns;

The function Language::getNsIndex() explicitly returns FALSE if the namespace name is not found, but since the above code does not check the type of the return value, a namespace ID of 0 (that is, NS_MAIN) is treated as nonexistent.

A quick glance at SVN (in mediawiki/trunk/phase3) suggests that this issue may still be present in the latest version.
Comment 1 Roan Kattouw 2010-03-26 20:56:17 UTC
Patch applied in r64224.
Comment 2 Chad H. 2010-08-30 14:06:50 UTC
*** Bug 23842 has been marked as a duplicate of this bug. ***

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


Navigation
Links