Last modified: 2010-05-15 15:38:17 UTC
The code replacing {{ns:##}} with namespace names doesn't check if the namespace exists but directly accesses the array, which of course makes php to produces notices about undefined index.
Created attachment 584 [details] Proposed patch
*** Bug 2321 has been marked as a duplicate of this bug. ***
This relates also to configurations where only one namespace is defined, where primary or talk namespace is missing. Eighter the tags "primary" or "talk" can generate the php error. Regards Reinhardt
(In reply to comment #3) > This relates also to configurations where only one namespace is defined, where > primary or talk namespace is missing. Eighter the tags "primary" or "talk" can > generate the php error. Not necessarily. In my case, it was generated by namespaces -3, 16, 17, 102, and 103, which are in article/talk pairs (except -3, which is a non-existant psuedo-namespace). This error is generated whenever Language::getNsText() is called. For example, the PHP code $badtitle = Title::makeName(42, 'foo_bar'); Will generate the error. Nothing is wrong with the parser, just a simple check in Language::getNsText() is needed (Language.php, line 1725-1728 in 1.4.4). I believe array_key_exists() would be the function.
(In reply to comment #4) > Nothing is wrong with the parser, just a simple check in Language::getNsText() > is needed (Language.php, line 1725-1728 in 1.4.4). I believe array_key_exists() > would be the function. That function is overwritten in other language files. In my opinion it's easier to fix it once in Parser than in every existing and new language file.
(In reply to comment #5) > That function is overwritten in other language files. In my opinion it's easier > to fix it once in Parser than in every existing and new language file. If something goes wrong with an extension, or the DB is modified, or some other internal error, it still will come up. Fix the bug at the source, don't hack around it. (And yes, I know how many language files there are.)
(My apologies for a harsh reply in #6) Try something like this: function getNsText( $index ) { $NamespaceNames = $this->getNamespaces(); if (!isset($NamespaceNames[$index])) return ''; return $NamespaceNames[$index]; } Then you just have to remove the function in the other files. (Assuming nothing funny is going on.) A similar thing should probably be done for Language::getNsIndex() as well.
(In reply to comment #7) Indeed that seems to be the best solution.
I modified the code suggested by Jamie and applied it to HEAD, marking it as FIXED.
*** Bug 2140 has been marked as a duplicate of this bug. ***