Page MenuHomePhabricator

Special:UserProfile should not use wfHttpError() for missing user parameters
Closed, ResolvedPublic


wfHttpError() is meant for simple server responses to calls from non-user facing entry points (e.g. thumb.php).

It circumvents OutputPage and Skin and leaves the user unable to navigate elsewhere. As general rule of thumb, any url reachable by a regular page link (or any page generated by OutputPage/Skin) should result in response powered by OutputPage. Not cut short by wfHttpError.

Should probably output a page querying the user for input. Similar to Special:FilePath, Special:CategoryTree, Special:CentralAuth, Special:JavaScriptTest, etc. do when accessed without parameters.

Alternatively, if you don't want to create any such landing page or form, at least output the the current error message wrapped in a Special page using a simple class=errorbox element.

Event Timeline

Krinkle created this task.Jan 7 2015, 3:02 PM
Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle added a subscriber: Krinkle.
Jdlrobson moved this task from Needs triage to Triaged on the Mobile board.Jan 21 2015, 12:01 AM

@Krinkle out of interest why is this the status quo? It seems like this would effect SEO and be cached on the local browser.
Why do we show error pages with a 200 instead of 404? Is this documented somewhere?

Krinkle updated the task description. (Show Details)Feb 4 2015, 6:12 PM
Krinkle set Security to None.
Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)Feb 4 2015, 6:20 PM

@Jdlrobson It is the status quo because outputting unstyled errors is not up to our standards. It lacks user experience (no navigation options, other than browser Back). Any user-accessible page ought to rendered with our visual identity.

We don't show error pages with HTTP 200. If some cases do, that's a bug. Using OutputPage/Skin or not has no relation to the http status code:

thanks for clarification @Krinkle - is there any page documented how to do a 404 / 400 with correct styling. Special:UserProfile without parameters should never be linked to from anywhere and should not come up in search engines.

@Jdlrobson I'm not sure what kind of documentation you're looking for. Output a page like any other and set the desired status code (if other than 200, which is PHP's default). There's no special error class for it. It's part of how OutputPage and Skin work. Just like setting page title, setting robot policy, setting canonical url, etc. one can also set status code.

Florian claimed this task.Feb 4 2015, 7:01 PM
gerritbot added a subscriber: gerritbot.

Change 188602 had a related patch set uploaded (by Florianschmidtwelzow):
SpecialUserProfile: Return Status code 404 when no user found


Hey @Krinkle I was merely hoping for some kind of php doc link to the relevant function. I don't like to assume volunteers know how to do this sort of thing so any guidance no matter how trivial it seems can help someone get their first commit in but looks like @Florian has made this unnecessary :)

Change 188602 merged by jenkins-bot:
SpecialUserProfile: Return Status code 404 when no user found

Jdlrobson closed this task as Resolved.Feb 4 2015, 9:12 PM