MediaWiki silently ignores attempts to set namespaces less than 0 or greater than 255
Closed, ResolvedPublic

Description

Author: qleah

Description:
However, it continues to process such an update, changing the namespace number
to 0 or 255, possibly destroying or duplicating content, or making pages
inaccessible. Do the Special: or Media: namespaces work at all? As far as I
can tell, the former is quietly redirected to MediaWiki:, and the latter to Image:.

Using an unsigned eight-bit value for namespace numbers is a terrible limitation
(it isn't even documented anywhere). In places, the code currently assumes
negative values are legal (e.g., NS_MEDIA = -2 and NS_SPECIAL = -1). Such a
small range will inevitably lead to namespace conflicts. Why was cur_namespace
chosen to be a tinyint?


Version: unspecified
Severity: normal

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz719.
bzimport created this task.Via LegacyOct 15 2004, 6:15 AM
brion added a comment.Via ConduitOct 15 2004, 6:35 AM

Special and media are, well, special namespaces: no pages are stored with them.

bzimport added a comment.Via ConduitOct 15 2004, 11:13 AM

rowan.collins wrote:

And presumably the reason for only allowing such a small range is that it was
never anticipated that anyone would want more seperate namespaces than that: the
original version had, what, about half a dozen? I honestly can't think why
anyone *would* want >256 different namespaces (or perhaps think of that as 128 +
an associated _talk for each one, but even then); unless they were trying to
create a "FractalWiki"-type system, where different namespaces were treated as
though they were their own wiki, in which case I think a limit on the number of
namespaces would be the least of their problems.

bzimport added a comment.Via ConduitOct 15 2004, 12:00 PM

qleah wrote:

(In reply to comment #2)

And presumably the reason for only allowing such a small range is that it was
never anticipated that anyone would want more seperate namespaces than that: the
original version had, what, about half a dozen? I honestly can't think why
anyone *would* want >256 different namespaces (or perhaps think of that as 128 +
an associated _talk for each one, but even then); unless they were trying to
create a "FractalWiki"-type system, where different namespaces were treated as
though they were their own wiki, in which case I think a limit on the number of
namespaces would be the least of their problems.

Yes, probably. The limit is fairly simple to adjust, even after the wiki has
been created, but it's aggravating. It still ought to handle values outside the
set range in a way that doesn't require repairing the database by hand.

It's really easy to encounter the limit if one isn't aware of it; the code
suggests that numbers down to -15 should be valid, and most people don't think
of 256 as a nice round number. I almost started adding custom namespaces at
1000 (thinking I'd seen that done somewhere else). Padding namespaces to avoid
collisions later gives maybe 20-40 names until the limit, starting from 100.

FractalWiki sounds fun. Are there wikis which support nested namespaces?

bzimport added a comment.Via ConduitOct 19 2004, 5:57 AM

jeluf wrote:

So, what is the bug here?
What do you mean by "Set namespace less than 0"? How do you set it, SQL?

bzimport added a comment.Via ConduitOct 19 2004, 10:52 AM

qleah wrote:

Custom namespaces are defined using the $wgExtraNamespaces array.
DefaultSettings.php provides an illustration:

  1. $wgExtraNamespaces =
  2. array(100 => "Hilfe",
  3. 101 => "Hilfe_Diskussion",
  4. 102 => "Aide",
  5. 103 => "Discussion_Aide");
hashar added a comment.Via ConduitNov 13 2004, 9:29 PM

I added a comment in defaultsettings (HEAD):

  1. Custom namespaces should start at 100 and stop at 255 (hard limit set by database)
bzimport added a comment.Via ConduitApr 24 2005, 4:00 AM

avarab wrote:

Marking this as FIXED.

brion added a comment.Via ConduitApr 24 2005, 4:46 AM

I have no idea why this was marked fixed, as it's not.

brion added a comment.Via ConduitMay 2 2005, 10:16 AM

Bumping namespace fields from tinyint to int in 1.5. Checked into CVS HEAD.

Add Comment