Page MenuHomePhabricator

PHP error when purging page in entity namespace with non-entity ID title
Closed, ResolvedPublic

Description

Found in Logstash:

PHP Error: Argument 1 passed to WikibaseQuality\ConstraintReport\Api\ResultsCache::delete() must be an instance of Wikibase\DataModel\Entity\EntityId, null given
#0 /srv/mediawiki/php-1.31.0-wmf.27/extensions/WikibaseQualityConstraints/src/Api/ResultsCache.php(85): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.31.0-wmf.27/extensions/WikibaseQualityConstraints/src/WikibaseQualityConstraintsHooks.php(80): WikibaseQuality\ConstraintReport\Api\ResultsCache->delete(NULL)
#2 /srv/mediawiki/php-1.31.0-wmf.27/includes/Hooks.php(177): WikibaseQuality\ConstraintReport\WikibaseQualityConstraintsHooks::onArticlePurge(WikiPage)
#3 /srv/mediawiki/php-1.31.0-wmf.27/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#4 /srv/mediawiki/php-1.31.0-wmf.27/includes/page/WikiPage.php(1171): Hooks::run(string, array)
#5 /srv/mediawiki/php-1.31.0-wmf.27/includes/page/Article.php(2133): WikiPage->doPurge()
#6 /srv/mediawiki/php-1.31.0-wmf.27/includes/actions/PurgeAction.php(45): Article->doPurge()
#7 /srv/mediawiki/php-1.31.0-wmf.27/includes/actions/PurgeAction.php(66): PurgeAction->onSubmit(array)
#8 /srv/mediawiki/php-1.31.0-wmf.27/includes/MediaWiki.php(500): PurgeAction->show()
#9 /srv/mediawiki/php-1.31.0-wmf.27/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#10 /srv/mediawiki/php-1.31.0-wmf.27/includes/MediaWiki.php(861): MediaWiki->performRequest()
#11 /srv/mediawiki/php-1.31.0-wmf.27/includes/MediaWiki.php(524): MediaWiki->main()
#12 /srv/mediawiki/php-1.31.0-wmf.27/index.php(42): MediaWiki->run()
#13 /srv/mediawiki/w/index.php(3): include(string)
#14 {main}

Only happened once in the past 24 hours. Request URL indicates someone was purging an item (let’s redact which one it was, it probably doesn’t matter – but the item exists and has no recent log actions that I can see), which might explain why it’s not a frequent error.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 4 2018, 1:46 PM

Ah, I think I see where the problem comes from… this is the request URL (with the numeric part of the item ID redacted):

/w/index.php?title=Q█████████/&action=purge

The trailing slash is probably the reason for the error – the page still has an entity content model, but you can’t form an item ID from that title.

Should we try to “fix” this error or just ignore when $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() ) returns null? It’s a different page, really, so I suppose we should just ignore it.

I can also provoke the same error by visiting https://www.wikidata.org/w/index.php?title=T191413&action=purge, so we definitely can’t fix this error in all cases, the title might just be garbage :)

Lucas_Werkmeister_WMDE renamed this task from Argument 1 passed to WikibaseQuality\ConstraintReport\Api\ResultsCache::delete() must be an instance of Wikibase\DataModel\Entity\EntityId, null given to PHP error when purging page in entity namespace with non-entity ID title.Apr 4 2018, 2:09 PM

Change 423979 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Don’t attempt to purge cache for invalid titles

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

Change 423979 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Don’t attempt to purge cache for invalid titles

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

Lucas_Werkmeister_WMDE closed this task as Resolved.Apr 5 2018, 8:27 AM
Lucas_Werkmeister_WMDE claimed this task.