Page MenuHomePhabricator

Unable to open edit page for some old revisions "PHP Fatal: Argument passed to EditPage::displayViewSourcePage() must implement interface Content"
Closed, ResolvedPublicPRODUCTION ERROR

Description

Spotted in production:

Catchable fatal error: Argument 1 passed to EditPage::displayViewSourcePage() must implement interface Content, null given in /srv/mediawiki/php-1.31.0-wmf.17/includes/EditPage.php on line 778

Details

Event Timeline

I can reproduce this here: https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit&oldid=749777530&section=999

Conditions:

  • Page is wikitext (or other content model that supports sections)
  • An old revision of that page used a different content model than wikitext (here, it's plaintext)
  • Trying to edit non-existent section of that revision

In this case, getContentObject() returns null, and displayViewSourcePage() doesn't handle that.

Krinkle renamed this task from Argument 1 passed to EditPage::displayViewSourcePage() must implement interface Content, null given to Unable to open edit page for some old revisions "PHP Fatal: Argument passed to EditPage::displayViewSourcePage() must implement interface Content".Sep 16 2018, 7:26 PM
Krinkle changed Risk Rating from N/A to default.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM

Change 584573 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Handle NULL result from EditPage::getContentObject

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

Ammarpad subscribed.
Ammarpad unsubscribed.

Change 584573 abandoned by Ammarpad:
[mediawiki/core@master] Disable section editing on non-current revision.

Reason:

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

@Ammarpad I see you abandoned the patch, has some other solution come up? Or was there a problem with the patch? I'm sorry you didn't get timely code review.

I reviewed and tested the patch. It's good to be merged. I'd like to understand why it was abandoned, though.

Change 584573 restored by Ammarpad:
[mediawiki/core@master] Disable section editing on non-current revision.

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

Change 584573 merged by jenkins-bot:
[mediawiki/core@master] Disable section editing on non-current revision.

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

Ammarpad claimed this task.