Last modified: 2012-07-01 20:46:28 UTC
Steps to reproduce: 1. Input the '#' as the search string. 2. Click on the 'Go' button. Actual Results: Main page displayed. Expected Results: 'There were no results matching the query.' message button should display.
It could take you to "Number sign" in the same way that @ takes you to "At sign" but AFAICT, "Go" simply puts the text in the URL. Thus, @ takes you to "At sign" because @ redirects there. Given that the # in the URL is, essentially, invisible to MW, I'm not sure there is much to do about it.
It should be possible to catch this gracefully, in theory at least. All searches go through "Special:Search", even searches using the "Go" button. In Monobook, this was done using a &go=Go parameter, e.g. <http://en.wikipedia.org/w/index.php?title=Special:Search&search=|&go=Go>. Vector seems to do this a little bit differently (omitting the &go=Go parameter), but the general idea is still the same. "#" is an illegal character in MediaWiki page titles. "|" is also an illegal character in MediaWiki page titles, but it can be caught gracefully. Other sites, such as Google, can gracefully catch "#", e.g. <http://www.google.com/search?q=%23>. I don't know of any technical reason "#" can't be caught gracefully when it's input into the search field directly. It may require special-casing in includes/specials/SpecialSearch.php, but there isn't anything impossibile here (that I'm aware of) that requires a "wontfix" resolution. Re-opening this for now.
*** Bug 32728 has been marked as a duplicate of this bug. ***
*** Bug 23799 has been marked as a duplicate of this bug. ***
The # is definitely not invisible to MediaWiki -- it'd be encoded as part of the query string, not a literal # on the form submission. It's only doing this because it's shoving things through title parsing to check for matches.
Seems FIXED (maybe accidentally?) Searching for '#' on enwiki sends me to the main page.
That would be an instance of the bug, not a fixed bug.
(In reply to comment #7) > That would be an instance of the bug, not a fixed bug. Sorry I misread the bug as "users should be sent to the main page".
Wait, why is what sounds like Title::newFromText( '#' ) being detected as the Main Page? That shouldn't default to anything like the main page. And it shouldn't be a title that can exist. Even if it could, we shouldn't be sending anyone anywhere when getText returns ''.
Because Title::newFromText( 'Foo#Bar' ) sends you to page Foo (section bar), so Title::newFromText( '#' ) sends you to section '' of page ''. And the default page if given '' is the main page. You can view how searching #Foo, sends you to Main_Page#Foo.
This also happens on search for ':' (a colon).
*** Bug 34545 has been marked as a duplicate of this bug. ***
As @Platonides already touched, this is not limited to search. The following also results in a link to the Main Page: [[#|foo]] See also bug 17006
*** This bug has been marked as a duplicate of bug 17006 ***