Page MenuHomePhabricator

Unexpected non-MediaWiki exception encountered, of type "InvalidArgumentException", line 63 of TimeDetailsFormatter.php
Open, LowestPublic

Description

This is an edge case, but one where i changed a snak to have mismatching property (data type) and datavalue. Then I tried to view a diff.

It would be good to make the diff rendering code more robust to handle this.

Unexpected non-MediaWiki exception encountered, of type "InvalidArgumentException"
[e8dfa289] /index.php?title=Q4&diff=1328&oldid=1327 Exception from line 63 of /Library/WebServer/Documents/php-master/extensions/Wikibase/lib/includes/formatters/TimeDetailsFormatter.php: Data value type mismatch. Expected an TimeValue.
Backtrace:
#0 /Library/WebServer/Documents/php-master/extensions/Wikibase/lib/includes/formatters/DispatchingValueFormatter.php(72): Wikibase\Lib\TimeDetailsFormatter->format(Wikibase\DataModel\Entity\EntityIdValue)
#1 /Library/WebServer/Documents/php-master/extensions/Wikibase/lib/includes/formatters/PropertyValueSnakFormatter.php(91): Wikibase\Lib\DispatchingValueFormatter->formatValue(Wikibase\DataModel\Entity\EntityIdValue, string)
#2 /Library/WebServer/Documents/php-master/extensions/Wikibase/lib/includes/formatters/PropertyValueSnakFormatter.php(73): Wikibase\Lib\PropertyValueSnakFormatter->formatValue(Wikibase\DataModel\Entity\EntityIdValue, string)
#3 /Library/WebServer/Documents/php-master/extensions/Wikibase/lib/includes/formatters/DispatchingSnakFormatter.php(74): Wikibase\Lib\PropertyValueSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#4 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/ClaimDifferenceVisualizer.php(243): Wikibase\Lib\DispatchingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#5 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/ClaimDifferenceVisualizer.php(184): Wikibase\ClaimDifferenceVisualizer->formatSnakDetails(Wikibase\DataModel\Snak\PropertyValueSnak)
#6 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/ClaimDifferenceVisualizer.php(109): Wikibase\ClaimDifferenceVisualizer->visualizeMainSnakChange(Diff\DiffOpChange)
#7 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/EntityDiffVisualizer.php(143): Wikibase\ClaimDifferenceVisualizer->visualizeClaimChange(Wikibase\ClaimDifference, Wikibase\DataModel\Claim\Statement)
#8 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/EntityDiffVisualizer.php(101): Wikibase\EntityDiffVisualizer->getClaimDiffHtml(Diff\DiffOpChange)
#9 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/EntityContentDiffView.php(177): Wikibase\EntityDiffVisualizer->visualizeDiff(Wikibase\DataModel\Entity\ItemDiff)
#10 /Library/WebServer/Documents/php-master/includes/diff/DifferenceEngine.php(732): Wikibase\EntityContentDiffView->generateContentDiffBody(Wikibase\ItemContent, Wikibase\ItemContent)
#11 /Library/WebServer/Documents/php-master/includes/diff/DifferenceEngine.php(654): DifferenceEngine->getDiffBody()
#12 /Library/WebServer/Documents/php-master/includes/diff/DifferenceEngine.php(624): DifferenceEngine->getDiff(string, string, string)
#13 /Library/WebServer/Documents/php-master/includes/diff/DifferenceEngine.php(443): DifferenceEngine->showDiff(string, string, string)
#14 /Library/WebServer/Documents/php-master/includes/Article.php(801): DifferenceEngine->showDiffPage(boolean)
#15 /Library/WebServer/Documents/php-master/includes/Article.php(540): Article->showDiffPage()
#16 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/actions/ViewEntityAction.php(198): Article->view()
#17 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/actions/ViewEntityAction.php(122): Wikibase\ViewEntityAction->displayEntityContent(Wikibase\ItemContent)
#18 /Library/WebServer/Documents/php-master/includes/Wiki.php(428): Wikibase\ViewEntityAction->show()
#19 /Library/WebServer/Documents/php-master/includes/Wiki.php(292): MediaWiki->performAction(Article, Title)
#20 /Library/WebServer/Documents/php-master/includes/Wiki.php(588): MediaWiki->performRequest()
#21 /Library/WebServer/Documents/php-master/includes/Wiki.php(447): MediaWiki->main()
#22 /Library/WebServer/Documents/php-master/index.php(49): MediaWiki->run()


Version: master
Severity: normal
Whiteboard: u=dev c=backend p=0

Details

Reference
bz63075

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:01 AM
bzimport set Reference to bz63075.
bzimport added a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

Can you provide the API request you used to create the mismatch?

Apparently happens whenever trying to diff an item against a property or vice versa:
https://www.wikidata.org/w/index.php?diff=246915894&oldid=141494563

thiemowmde lowered the priority of this task from Medium to Lowest.Apr 24 2017, 8:41 AM
thiemowmde added a subscriber: hoo.

I tried to reproduce this locally in many different ways, but failed.

Both example URLs given in this ticket compare an Item with a Property, but when I try this locally the EntityDiffer always gives me the proper InvalidArgumentException saying "Can only diff two entities of the same type", as I would expect. I even tried to change the type of a "string" property to "url", because it appears this is what happened in the given examples. Still the same expected "Can only diff two entities of the same type", no matter what I compare.

How can we reproduce this?

Can you please, for a start, post a fresh call stack? The one in the tickets description is very much outdated.