Page MenuHomePhabricator

Diffing between different content models throws a fatal error
Closed, DuplicatePublic

Description

Example URL is a diff between Q2415852 and WD:RFD, which throws a "[6ff49246] 2013-06-25 23:49:04: Fatal exception of type MWException".

Using Special:ComparePages (https://www.wikidata.org/wiki/Special:ComparePages?page1=Q1&rev1=&page2=User%3ALegoktm&rev2=&action=&diffonly=&unhide=), gives the "Wikimedia Foundation Error" screen with: " PHP fatal error in /usr/local/apache/common-local/php-1.22wmf8/extensions/Wikibase/repo/includes/EntityContentDiffView.php line 136:
Call to undefined method WikitextContent::getEntity() "

Neither of these two situations should result in fatal errors, just a message saying something like "You cannot diff between these two pages since they use different contentmodels."


URL: https://www.wikidata.org/w/index.php?title=Q2415852&diff=52444738&oldid=52444477
See Also:
T43658: Bad content model: expected javascript but got wikitext.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:05 AM
bzimport set Reference to bz50202.
bzimport added a subscriber: Unknown Object (MLST).

Sounds like a problem in Wikibase extension, because EntityContentDiffView.php is part of that.

Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

Change 349878 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Proper error when Special:ComparePages diffs entity with non-entity

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

thiemowmde lowered the priority of this task from Medium to Lowest.Apr 24 2017, 8:27 AM
thiemowmde edited subscribers, added: Addshore, aude, hoo, thiemowmde; removed: gerritbot.

In https://gerrit.wikimedia.org/r/349878 I was able to fix https://www.wikidata.org/wiki/Special:ComparePages?page1=Q1&page2=User:Legoktm.

I failed to fix https://www.wikidata.org/w/?oldid=474416118&diff=200573384. This is a request for the exact same diff, but follows an entirely different code path. This never calls Wikibase code, except for the deserialization of an entity, but this code path does not know it's run in a diff context. I tried to hook into DifferenceEngine (it provides 19 hooks), but could not find one that allows for an easy fix.

Change 349878 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Proper error when Special:ComparePages diffs entity with non-entity

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

@thiemowmde Whether the diff view code for EntityContent is called or not depends on which way you ask for the diff. When comparing two different kinds of content, it's unclear which diff code to use - that's exactly the reason the exception is thrown.

The real solution to this problem would be to throw a more specific exception in this case, and catch it in Article or DifferenceEngine, and show a nice message. Or catch the condition earlier, before it triggers an exception, in Article or DifferenceEngine.

I do not plan to invest more time on this right now. Everything you said is fine. But even considering all this I think my patch https://gerrit.wikimedia.org/r/349878 is acceptable and does not interfere with one of the possible future solutions you proposed.