Author: quietust
Description:
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.
Version: 1.15.x
Severity: normal
OS: Windows XP