Page MenuHomePhabricator

[Bug] Uncatched UnsupportedObjectException in EntityContent::getNativeData
Closed, ResolvedPublic

Description

The WikibaseLexeme tests currently fail:

Wikibase\Lexeme\Tests\MediaWiki\Api\LexemeEditEntityTest::testGivenInvalidDataInClearRequest_errorIsReported with data set "language missing in new data" (array(array(array('en', 'foo')), 'Q55'))
Failed asserting that Serializers\Exceptions\UnsupportedObjectException Object (...) is an instance of class "ApiUsageException".

/home/jenkins/workspace/mwext-testextension-hhvm-composer-jessie/src/extensions/WikibaseLexeme/tests/phpunit/mediawiki/Api/LexemeEditEntityTest.php:482
/home/jenkins/workspace/mwext-testextension-hhvm-composer-jessie/src/tests/phpunit/MediaWikiTestCase.php:416
/home/jenkins/workspace/mwext-testextension-hhvm-composer-jessie/src/maintenance/doMaintenance.php:94

Here is a more detailed call stack:

Wikibase\Lexeme\Tests\MediaWiki\Api\LexemeEditEntityTest::testGivenInvalidDataInClearRequest_errorIsReported with data set "language and lexical category missing in new data" (array(array(array('en', 'foo'))))
Serializers\Exceptions\UnsupportedObjectException: Can not serialize incomplete Lexeme

/var/www/mediawiki/core/extensions/WikibaseLexeme/src/DataModel/Serialization/StorageLexemeSerializer.php:95
/var/www/mediawiki/core/extensions/WikibaseLexeme/src/DataModel/Serialization/StorageLexemeSerializer.php:66
/var/www/mediawiki/core/extensions/WikibaseLexeme/src/DataModel/Serialization/ExternalLexemeSerializer.php:59
/var/www/mediawiki/core/extensions/WikibaseLexeme/src/DataModel/Serialization/ExternalLexemeSerializer.php:55
/var/www/mediawiki/core/extensions/WikibaseMediaInfo/vendor/serialization/serialization/src/Serializers/DispatchingSerializer.php:42
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/Content/EntityContent.php:453
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/Content/EntityContent.php:462
/var/www/mediawiki/core/includes/content/ContentHandler.php:780
/var/www/mediawiki/core/includes/content/ContentHandler.php:923
/var/www/mediawiki/core/includes/page/WikiPage.php:1621
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php:292
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php:189
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/EditEntity.php:712
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php:351
/var/www/mediawiki/core/extensions/Wikibase/repo/includes/Api/ModifyEntity.php:286
/var/www/mediawiki/core/includes/api/ApiMain.php:1582
/var/www/mediawiki/core/includes/api/ApiMain.php:513
/var/www/mediawiki/core/tests/phpunit/includes/api/ApiTestCase.php:99
/var/www/mediawiki/core/extensions/Wikibase/repo/tests/phpunit/includes/Api/WikibaseApiTestCase.php:100
/var/www/mediawiki/core/extensions/WikibaseLexeme/tests/phpunit/mediawiki/Api/LexemeEditEntityTest.php:477
/var/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:416
/var/www/mediawiki/core/maintenance/doMaintenance.php:94

The core change to "blame" is https://gerrit.wikimedia.org/r/390224 (T167656):

  • ContentHandler::getChangeType calls Content::getSize.
  • EntityContent::getSize calls EntityContent::getNativeData.
  • EntityContent::getNativeData serializes the entity object into an array structure. This serializer call does not catch SerializationExceptions. It assumes the entity can be serialized.
  • The concept of an "unserializable" entity never existed before. StorageLexemeSerializer is the first serializer introducing such a concept. This is why this code path never failed before, but does now.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 5 2017, 12:20 PM

Change 395515 had a related patch set uploaded (by Thiemo Mättig (WMDE); owner: Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Catch uncatched SerializationException in EntityContent::getNativeData

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

thiemowmde triaged this task as High priority.Dec 5 2017, 3:51 PM

Change 395515 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Catch uncatched SerializationException in EntityContent::getNativeData

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

thiemowmde closed this task as Resolved.Dec 6 2017, 1:17 PM
thiemowmde moved this task from Review to Done on the Wikidata-Sprint-2017-12-06 board.
thiemowmde removed a project: Patch-For-Review.