Page MenuHomePhabricator

TypeError: Argument 1 passed to EditPage::displayViewSourcePage() must implement interface Content, null given, called in /srv/mediawiki/php-1.38.0-wmf.3/includes/EditPage.php on line 646
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   TypeError: Argument 1 passed to EditPage::displayViewSourcePage() must implement interface Content, null given, called in /srv/mediawiki/php-1.38.0-wmf.3/includes/EditPage.php on line 646
exception.trace
from /srv/mediawiki/php-1.38.0-wmf.3/includes/EditPage.php(801)
#0 /srv/mediawiki/php-1.38.0-wmf.3/includes/EditPage.php(646): EditPage->displayViewSourcePage(NULL, string)
#1 /srv/mediawiki/php-1.38.0-wmf.3/includes/actions/EditAction.php(71): EditPage->edit()
#2 /srv/mediawiki/php-1.38.0-wmf.3/includes/actions/SubmitAction.php(38): EditAction->show()
#3 /srv/mediawiki/php-1.38.0-wmf.3/includes/MediaWiki.php(538): SubmitAction->show()
#4 /srv/mediawiki/php-1.38.0-wmf.3/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#5 /srv/mediawiki/php-1.38.0-wmf.3/includes/MediaWiki.php(925): MediaWiki->performRequest()
#6 /srv/mediawiki/php-1.38.0-wmf.3/includes/MediaWiki.php(559): MediaWiki->main()
#7 /srv/mediawiki/php-1.38.0-wmf.3/index.php(53): MediaWiki->run()
#8 /srv/mediawiki/php-1.38.0-wmf.3/index.php(46): wfIndexMain()
#9 /srv/mediawiki/w/index.php(3): require(string)
#10 {main}
Notes

A batch of 9 of these occurred a few minutes ago.

Details

Request URL
https://my.wikipedia.org/w/index.php?action=submit&title=*

Event Timeline

Krinkle moved this task from Untriaged to Oct 2021 on the Wikimedia-production-error board.
Krinkle subscribed.

The previous two instances of this error were handled by PET, and were associated with an EditPage refactor that PET was undertaking. Might be fallout from that.

The problematic code as introduced here:
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/642481/1/includes/EditPage.php#744 in 2020.

$this->getContentObject() is assumed to return a Content instance, but it can also return null and false under some circumstances. There is a similar call to displayViewSourcePage() further up in the same method which makes the same assumption. That has been there since 2015.

I suppose the solution is to introduce appropriate error handling, though I'm not sure what exactly the appropriate handling would be here. Pinging @Cparle.

Perhaps the correct thing to do would be to move the error handling code from https://gerrit.wikimedia.org/r/c/mediawiki/core/+/683390/2/includes/EditPage.php#816 into getContentObject, so that it will always return a Content instance (or throw).

I don't see this error in the logs any more. Possibly someone somehow fixed it, or it might have morphed into T301947. Either way I don't think this task is useful any more.