Last modified: 2014-11-17 10:36:01 UTC
[[#]] or [[#|foobar]] links to a null page name rather than a null section. The example links point to http://en.wikipedia.org/wiki/ which redirects to the main page. (except for [[##]] which points to the current url plus "#.23") As far as html literalism goes the least astonishing behavior for [[#]] would be to make a link like this <a href="#">#</a> that would be the same as "#top" except in cases where it is overridden by a javascript onClick attribute (which it is, most times you see anything like this). course if there's some way to make it turn blue and clickable but not actually do anything that might be best... i'm not sure when this would intentionally be used except when attempting to create a blue link that does nothing ever. That's how i stumbled upon it after all :-/
Probably a bad check for fragments somewhere.... perhaps in multiple places. It should indeed be possible to add an empty fragment but _have_ a fragment... which perhaps complicates things. :D
I've tracked it down to Title::getLinkUrl(), the problem is that Title stores fragments without the leading #, then adds it back on when making a URL (Title::getFragmentForURL()), so it doesn't know the difference between a blank fragment and no fragment at all. So when making the URL, it sees no namespace, no text, and no fragment.
We could use false or null to distinguish between empty string and not-present... but then we have to be more anal about all the checks... or replace the != '' etc with a hasFragment() which'll be easier to remember.
We could also probably reasonably assume that if we've ended up with an empty title object, it's a self-link with empty fragment, so could handle it as a special case.
*** Bug 26766 has been marked as a duplicate of this bug. ***
*** Bug 32728 has been marked as a duplicate of this bug. ***
*** Bug 23799 has been marked as a duplicate of this bug. ***
*** Bug 34545 has been marked as a duplicate of this bug. ***
*** Bug 33437 has been marked as a duplicate of this bug. ***
*** Bug 38103 has been marked as a duplicate of this bug. ***
Still valid in 1.21wmf8.
*** Bug 44270 has been marked as a duplicate of this bug. ***
Raising the importance according to the number of dupes - obviously very wanted feature and more and more actual when we create more and more gadgets nowadays.
*** Bug 58647 has been marked as a duplicate of this bug. ***
Title::hasFragment as mention by brion in comment 3 was added with Gerrit change #104750, so checking against false or null would be possible (for core)