Page MenuHomePhabricator

Deleting a page that is part of a partial block causes problems
Closed, ResolvedPublic1 Estimated Story Points

Description

In test.wikipedia.org Mediawiki 1.33.0-wmf.14 (rMWa6319bcf893c):

1: Partial block User:Apples from a page (e.g. Astronaut)
2: delete Astronaut
3: Now User:Apples cannot edit at all, anywhere!

User Jni-test789 sees error messages:

Screen Shot 2019-01-30 at 3.30.09 PM.png (928×1 px, 183 KB)
Screen Shot 2019-01-30 at 3.24.07 PM.png (928×1 px, 83 KB)

PHP fatal error: Argument 1 passed to Title::equals() must be an instance of Title, null given

Also the page name vanishes from block list:

https://test.wikipedia.org/wiki/Special:BlockList?wpTarget=Jni-test789&limit=50&wpFormIdentifier=blocklist

Even worse, now I the blocking admin (in separate browser application) get the same error when trying to navigate to the deleted page:

https://test.wikipedia.org/w/index.php?title=User:Jni-test789/sandbox&action=edit&redlink=1

Or when I try to edit the block, I recieve:

Screen Shot 2019-01-30 at 3.25.01 PM.png (928×1 px, 275 KB)

Restoring the page restores blocked users editing of other pages and my access to it.

Event Timeline

TBolliger moved this task from Untriaged to Triage/To be Estimated on the Anti-Harassment board.
TBolliger subscribed.

Yep, just reproduced. This happens when the page deleted is the only page of a partial block, or one of many.

TBolliger renamed this task from Deleting a page that is part of a partial block prevents blocked user editing any redlinked pages to Deleting a page that is part of a partial block causes problems.Jan 30 2019, 11:31 PM
TBolliger updated the task description. (Show Details)

Change 487310 had a related patch set uploaded (by Dbarratt; owner: Dbarratt):
[mediawiki/core@master] PageRestriction::getTitle() can return null which throws a fatal PHP error.

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

dbarratt edited projects, added Anti-Harassment (Bet — ב); removed Anti-Harassment.
dbarratt set the point value for this task to 1.
dbarratt moved this task from Ready to Review on the Anti-Harassment (Bet — ב) board.

Change 487310 merged by jenkins-bot:
[mediawiki/core@master] Prevent fatal PHP errors when PageRestriction::getTitle() returns null.

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

Behaviour in Description no longer occurs. Deleting a blocked page does not prevent the user editing other pages, anyone visiting the deleted page or the admin from editing or deleting the block.

The deleted page does not appear in the BlockList, but I think this is reasonable. The row blocking the user from the (now deleted) page remains in ipblocks_restrictions (unless you edit the block, in which case it is deleted). If you restore the deleted page then the block for that page comes into force again.

I have tried this for pages in namespaces main, User, User_talk and File. It does not seem likely that this would make a difference as page blocks appear to work the same for all namespaces.

Tried the same with an IP that was autoblocked. Same deal as above.

Testing on https://en.wikipedia.beta.wmflabs.org (version 1.33.0-alpha (4091905) 05:36, 13 February 2019) and my local wiki (1.33.0-alpha (9eafd89) 16:27, 12 February 2019).

@dbarratt I think I am ready to call this done, but please review. My understanding is that the bug occurred when a row in the table "ipblocks_restrictions" referred to a row in the table "page" that no longer existed. Deleting the page removed the row in the table, and so caused the problems we were seeing. I cannot see other variables or conditions that are relevant, so I cannot see anything else to test.

dbarratt subscribed.
dbarratt unsubscribed.