Page MenuHomePhabricator

TypeError: Argument 1 passed to EditPage::displayViewSourcePage() must implement interface Content, null given
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.37.0-wmf.1/includes/EditPage.php on line 807
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.1/includes/EditPage.php(816)
#0 /srv/mediawiki/php-1.37.0-wmf.1/includes/EditPage.php(807): EditPage->displayViewSourcePage(NULL, string)
#1 /srv/mediawiki/php-1.37.0-wmf.1/includes/EditPage.php(611): EditPage->displayPermissionsError(array)
#2 /srv/mediawiki/php-1.37.0-wmf.1/includes/actions/EditAction.php(71): EditPage->edit()
#3 /srv/mediawiki/php-1.37.0-wmf.1/includes/actions/SubmitAction.php(38): EditAction->show()
#4 /srv/mediawiki/php-1.37.0-wmf.1/includes/MediaWiki.php(535): SubmitAction->show()
#5 /srv/mediawiki/php-1.37.0-wmf.1/includes/MediaWiki.php(319): MediaWiki->performAction(Article, Title)
#6 /srv/mediawiki/php-1.37.0-wmf.1/includes/MediaWiki.php(916): MediaWiki->performRequest()
#7 /srv/mediawiki/php-1.37.0-wmf.1/includes/MediaWiki.php(550): MediaWiki->main()
#8 /srv/mediawiki/php-1.37.0-wmf.1/index.php(53): MediaWiki->run()
#9 /srv/mediawiki/php-1.37.0-wmf.1/index.php(46): wfIndexMain()
#10 /srv/mediawiki/w/index.php(3): require(string)
#11 {main}
Impact
  • 4 times in 24 hours
  • Users will see a system error page and their edit will not be saved
Notes

Details

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

Event Timeline

Change 683390 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] EditPage::displayPermissionsError always use exception if no content

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

Not sure what the root cause is, but sent a hotfix to replace the php error with a nicer PermissionsError

When Content::getSection fails in EditPage::getContentObject it is returning $def_content which is null here.

One possible way:

  • Start editing the last section on a talk page
  • Let another user remove the section on the page
  • Let a sysop protect the page (or another way to trigger a permission error, like blocking the first user)
  • Save the page with the first user

The first user now has an invalid section name and needs the permission error page, showing the stack trace. Not sure if that use case is worth to have a unit test for

Change 683390 merged by jenkins-bot:

[mediawiki/core@master] EditPage::displayPermissionsError always use exception if no content

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