Page MenuHomePhabricator

[LEX] Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations()
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations()
exception.trace
from /srv/mediawiki/php-1.41.0-wmf.13/extensions/WikibaseLexeme/src/Presentation/Formatters/FormIdTextFormatter.php(57)
#0 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/lib/includes/Formatters/EntityIdValueFormatter.php(44): Wikibase\Lexeme\Presentation\Formatters\FormIdTextFormatter->formatEntityId(Wikibase\DataModel\Entity\ItemId)
#1 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/lib/includes/Formatters/DispatchingValueFormatter.php(72): Wikibase\Lib\Formatters\EntityIdValueFormatter->format(Wikibase\DataModel\Entity\EntityIdValue)
#2 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/lib/includes/Formatters/PropertyValueSnakFormatter.php(148): Wikibase\Lib\Formatters\DispatchingValueFormatter->formatValue(Wikibase\DataModel\Entity\EntityIdValue, string)
#3 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/lib/includes/Formatters/PropertyValueSnakFormatter.php(117): Wikibase\Lib\Formatters\PropertyValueSnakFormatter->formatValue(Wikibase\DataModel\Entity\EntityIdValue, string)
#4 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/lib/includes/Formatters/DispatchingSnakFormatter.php(150): Wikibase\Lib\Formatters\PropertyValueSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#5 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/lib/includes/Formatters/ErrorHandlingSnakFormatter.php(68): Wikibase\Lib\Formatters\DispatchingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#6 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/repo/includes/Api/FormatSnakValue.php(177): Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#7 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Wikibase/repo/includes/Api/FormatSnakValue.php(145): Wikibase\Repo\Api\FormatSnakValue->formatValue(array, Wikibase\DataModel\Entity\EntityIdValue, NULL)
#8 /srv/mediawiki/php-1.41.0-wmf.13/includes/api/ApiMain.php(1913): Wikibase\Repo\Api\FormatSnakValue->execute()
#9 /srv/mediawiki/php-1.41.0-wmf.13/includes/api/ApiMain.php(890): ApiMain->executeAction()
#10 /srv/mediawiki/php-1.41.0-wmf.13/includes/api/ApiMain.php(861): ApiMain->executeActionWithErrorHandling()
#11 /srv/mediawiki/php-1.41.0-wmf.13/api.php(95): ApiMain->execute()
#12 /srv/mediawiki/php-1.41.0-wmf.13/api.php(48): wfApiMain()
#13 /srv/mediawiki/w/api.php(3): require(string)
#14 {main}
Impact

Minimal. An invalid request with no sensible interpretation can be used to trigger logspam. Only one actual occurrence in logstash.

Notes

The decoded request URL is:

In other words, someone’s formatting an item ID value with a property that’s intended for form IDs, hence the type error. The formatter just needs to handle this a bit more carefully (producing a better error when the given value doesn’t look as expected).
A similar exception was previously seen in CI: T201988: FormIdHtmlFormatter: Call to undefined method Item::getRepresentations()

Details

Request URL
https://www.wikidata.org/w/api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%7B%22id%22%3A%22Q96%22%7D%2C%22type%22%3A%22wikibase-entityid%22%7D&errorformat=plaintext&format=json&generate=text%2Fplain&options=%7B%22lang%22%3A%22en%22%7D&property=P5193&uselang=en

Event Timeline

SenseIdTextFormatter almost certainly has the same bug, and we should also check FormIdHtmlFormatter and SenseIdHtmlFormatter.

ItamarWMDE renamed this task from Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations() to [LEX] Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations().Wed, Nov 8, 10:50 AM
ItamarWMDE moved this task from Incoming to [DOT] By Project on the wmde-wikidata-tech board.
ItamarWMDE added a project: Wikidata Dev Team.

Prio Notes

Impact AreaAffected
production / end usersyes
monitoringno
development effortsno
onboarding effortsno
additional stakeholdersmaybe
ItamarWMDE renamed this task from [LEX] Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations() to [SW] [LEX] Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations().Tue, Nov 21, 4:01 PM
ItamarWMDE renamed this task from [SW] [LEX] Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations() to [LEX] Error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations().Wed, Dec 6, 10:20 AM