Page MenuHomePhabricator

"index.php?diff=anyNonInteger" shows an unexpected diff, should instead give proper error message
Open, In Progress, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • Unexpected main page diff is shown

What should have happened instead?:

  • User friendly error should be shown, such as "invalid page ID" or "invalid revision ID" or similar

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

This diff is not random; it is the latest change of main page. Also this will happer if diff is other non-number (such as https://www.wikidata.org/w/index.php?diff=abc)

Novem_Linguae renamed this task from "index.php?diff=undefined" shows a random diff, should instead give proper error message to "index.php?diff=anyNonInteger" shows an unexpected diff, should instead give proper error message.Jan 12 2023, 2:06 AM
Novem_Linguae updated the task description. (Show Details)

Only a revision id, prev and next are allowed. Other letters are casted to integer 0 and that loads the latest version. Also happen when using directly diff=0. Without any title information that is the main page (but it would show the latest diff of other pages, when title= is given)

Using oldid=abc provides no error as well (when not numeric it is treated as non-existing)

https://www.wikidata.org/w/index.php?oldid=abc

See also T258878 (which is about an empty diff=, also casted to 0 and showing the diff of the latest), could be treated as duplicate bug, but could be a extra special page as well.

Change 982437 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/core@master] Invalid ?diff= now displays an error

https://gerrit.wikimedia.org/r/982437

Novem_Linguae changed the task status from Open to In Progress.Dec 13 2023, 6:11 AM
Novem_Linguae claimed this task.

Change 982437 abandoned by Novem Linguae:

[mediawiki/core@master] Invalid ?diff= now displays an error

Reason:

not an easy fix. will add some unit tests instead, to make it easier for next person who works on this

https://gerrit.wikimedia.org/r/982437

Change 985107 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/core@master] Add tests for includes/MediaWiki.php

https://gerrit.wikimedia.org/r/985107

Change 985107 merged by jenkins-bot:

[mediawiki/core@master] Add tests for includes/MediaWiki.php

https://gerrit.wikimedia.org/r/985107