Page MenuHomePhabricator

Special:EntityData crashes when providing JSON data of entities of custom type (not item or property)
Closed, ResolvedPublic

Description

When accessing Special:EntityData for MediaInfo entity, asking for JSON output, special page crashes with stack trace as below:

[6d0b845caa74256237546aad] /otherwiki/index.php/Special:EntityData/M4.json Serializers\Exceptions\UnsupportedObjectException from line 46 of extensions/WikibaseMediaInfo/vendor/serialization/serialization/src/Serializers/DispatchingSerializer.php:

Backtrace:

#0 extensions/Wikibase/repo/includes/Api/ResultBuilder.php(339): Serializers\DispatchingSerializer->serialize(Wikibase\MediaInfo\DataModel\MediaInfo)
#1 extensions/Wikibase/repo/includes/Api/ResultBuilder.php(304): Wikibase\Repo\Api\ResultBuilder->getEntityArray(Wikibase\MediaInfo\DataModel\MediaInfo, string, NULL, array, array)
#2 extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(415): Wikibase\Repo\Api\ResultBuilder->addEntityRevision(NULL, Wikibase\EntityRevision)
#3 extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(443): Wikibase\Repo\LinkedData\EntityDataSerializationService->generateApiResult(Wikibase\EntityRevision, ApiFormatJson)
#4 extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(170): Wikibase\Repo\LinkedData\EntityDataSerializationService->getApiSerialization(Wikibase\EntityRevision, ApiFormatJson)
#5 extensions/Wikibase/repo/includes/LinkedData/EntityDataRequestHandler.php(443): Wikibase\Repo\LinkedData\EntityDataSerializationService->getSerializedData(string, Wikibase\EntityRevision, NULL, array, NULL)
#6 extensions/Wikibase/repo/includes/LinkedData/EntityDataRequestHandler.php(236): Wikibase\Repo\LinkedData\EntityDataRequestHandler->showData(WebRequest, OutputPage, string, Wikibase\MediaInfo\DataModel\MediaInfoId, integer)
#7 extensions/Wikibase/repo/includes/Specials/SpecialEntityData.php(152): Wikibase\Repo\LinkedData\EntityDataRequestHandler->handleRequest(string, WebRequest, OutputPage)
#8 includes/specialpage/SpecialPage.php(522): Wikibase\Repo\Specials\SpecialEntityData->execute(string)
#9 includes/specialpage/SpecialPageFactory.php(576): SpecialPage->run(string)
#10 includes/MediaWiki.php(285): SpecialPageFactory::executePath(Title, RequestContext)
#11 includes/MediaWiki.php(860): MediaWiki->performRequest()
#12 includes/MediaWiki.php(521): MediaWiki->main()
#13 index.php(43): MediaWiki->run()
#14 {main}

Apparently EntityDataSerializationService uses from Serializer instance for entities, that is only aware of items and properties.

Event Timeline

WMDE-leszek moved this task from Backlog to Doing on the Wikidata-Former-Sprint-Board board.

Change 342642 had a related patch set uploaded (by WMDE-leszek):
[mediawiki/extensions/Wikibase] Use custom-entity-type-aware entity serializer in EntityDataSerializationService

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

Change 342642 merged by jenkins-bot:
[mediawiki/extensions/Wikibase] Use custom-entity-type-aware entity serializer in EntityDataSerializationService

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

Change 342816 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase] Do not use SerializerFactory::newEntitySerializer in tests

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

Change 342816 merged by jenkins-bot:
[mediawiki/extensions/Wikibase] Do not use SerializerFactory::newEntitySerializer in tests

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