Page MenuHomePhabricator

Clicking undo on an edit that changed the content model results in a MWException
Closed, ResolvedPublic

Description

[V9DF6QpAEK0AAC8UbGwAAABI] /w/index.php?title=Law2&action=edit&undoafter=296827&undo=296828 MWException from line 570 of /srv/mediawiki/php-1.28.0-wmf.18/includes/content/ContentHandler.php: Bad content model: expected json but got wikitext.

Backtrace:

#0 /srv/mediawiki/php-1.28.0-wmf.18/includes/content/ContentHandler.php(1023): ContentHandler->checkModelID(string)
#1 /srv/mediawiki/php-1.28.0-wmf.18/includes/page/WikiPage.php(1352): ContentHandler->getUndoContent(Revision, Revision, Revision)
#2 /srv/mediawiki/php-1.28.0-wmf.18/includes/EditPage.php(1128): WikiPage->getUndoContent(Revision, Revision)
#3 /srv/mediawiki/php-1.28.0-wmf.18/includes/EditPage.php(1046): EditPage->getContentObject(boolean)
#4 /srv/mediawiki/php-1.28.0-wmf.18/includes/EditPage.php(606): EditPage->initialiseForm()
#5 /srv/mediawiki/php-1.28.0-wmf.18/includes/actions/EditAction.php(59): EditPage->edit()
#6 /srv/mediawiki/php-1.28.0-wmf.18/includes/MediaWiki.php(505): EditAction->show()
#7 /srv/mediawiki/php-1.28.0-wmf.18/includes/MediaWiki.php(289): MediaWiki->performAction(Article, Title)
#8 /srv/mediawiki/php-1.28.0-wmf.18/includes/MediaWiki.php(750): MediaWiki->performRequest()
#9 /srv/mediawiki/php-1.28.0-wmf.18/includes/MediaWiki.php(521): MediaWiki->main()
#10 /srv/mediawiki/php-1.28.0-wmf.18/index.php(43): MediaWiki->run()
#11 /srv/mediawiki/w/index.php(3): include(string)
#12 {main}

When visiting https://test2.wikipedia.org/w/index.php?title=Law2&action=edit&undoafter=296827&undo=296828.

Event Timeline

Legoktm created this task.Sep 8 2016, 2:05 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 8 2016, 2:05 AM

Change 309234 had a related patch set uploaded (by Legoktm):
Don't throw exceptions in ContentHandler::getUndoContent()

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

Change 309234 merged by jenkins-bot:
Don't throw exceptions in ContentHandler::getUndoContent()

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

Fixed the exception at least. Still doing a little digging to see if we can make undo actually undo the content model change, but that is looking rather complicated so far... :/

Change 309490 had a related patch set uploaded (by Legoktm):
API: When undoing an edit, allow overriding content model.

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

Change 309480 had a related patch set uploaded (by Legoktm):
Allow undoing edits that change content model if top

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

Change 309480 merged by jenkins-bot:
Allow undoing edits that change content model if top

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

Change 309490 merged by jenkins-bot:
API: When undoing an edit, allow overriding content model.

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

Legoktm closed this task as Resolved.Sep 9 2016, 4:27 AM
Legoktm reassigned this task from Legoktm to Bawolff.