Page MenuHomePhabricator

[Bug] SpamBlacklist hook causes Wikibase LinkTitle api phpunit tests to fail
Closed, ResolvedPublicPRODUCTION ERROR

Description

This issue might go away when we decouple entity content and the api more, but the issue can still occur with new entities. A solution should be found.

EditEntity uses RequestContext::getMain() in case of a new entity. If entity is created via a special page, then special page is the title. If entity is created via the api, then Title (including $wgTitle, which request context uses as fallback) is null and has potential to cause issues.

Catchable fatal error: Argument 1 passed to Wikibase\EntityContent::getParserOutput() must be an instance of Title, null given, called in /Library/WebServer/Documents/php-master/extensions/SpamBlacklist/SpamBlacklistHooks.php on line 28 and defined in /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/content/EntityContent.php on line 142

Call Stack:

0.0004     671968   1. {main}() /Library/WebServer/Documents/php-master/tests/phpunit/phpunit.php:0
0.0763   18376552   2. MediaWikiPHPUnitCommand::main() /Library/WebServer/Documents/php-master/tests/phpunit/phpunit.php:116
0.0764   18389232   3. MediaWikiPHPUnitCommand->run() /Library/WebServer/Documents/php-master/tests/phpunit/MediaWikiPHPUnitCommand.php:64
0.0764   18389280   4. PHPUnit_TextUI_Command->run() /Library/WebServer/Documents/php-master/tests/phpunit/MediaWikiPHPUnitCommand.php:80
0.1002   22719232   5. PHPUnit_TextUI_TestRunner->doRun() /opt/local/lib/php/pear/PHPUnit/TextUI/Command.php:176
0.1032   23221488   6. PHPUnit_Framework_TestSuite->run() /opt/local/lib/php/pear/PHPUnit/TextUI/TestRunner.php:349
0.1033   23222328   7. PHPUnit_Framework_TestSuite->run() /opt/local/lib/php/pear/PHPUnit/Framework/TestSuite.php:705
3.5036   65873376   8. PHPUnit_Framework_TestSuite->runTest() /opt/local/lib/php/pear/PHPUnit/Framework/TestSuite.php:745
3.5036   65873376   9. MediaWikiTestCase->run() /opt/local/lib/php/pear/PHPUnit/Framework/TestSuite.php:775
3.5052   65873296  10. PHPUnit_Framework_TestCase->run() /Library/WebServer/Documents/php-master/tests/phpunit/MediaWikiTestCase.php:134
3.5052   65873296  11. PHPUnit_Framework_TestResult->run() /opt/local/lib/php/pear/PHPUnit/Framework/TestCase.php:783
3.5053   65874288  12. PHPUnit_Framework_TestCase->runBare() /opt/local/lib/php/pear/PHPUnit/Framework/TestResult.php:648
3.5500   65927392  13. PHPUnit_Framework_TestCase->runTest() /opt/local/lib/php/pear/PHPUnit/Framework/TestCase.php:838
3.5500   65929016  14. ReflectionMethod->invokeArgs() /opt/local/lib/php/pear/PHPUnit/Framework/TestCase.php:983
3.5500   65929048  15. Wikibase\Test\Api\LinkTitlesTest->testLinkTitles() /opt/local/lib/php/pear/PHPUnit/Framework/TestCase.php:983
3.5500   65929832  16. Wikibase\Test\Api\WikibaseApiTestCase->doApiRequestWithToken() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/tests/phpunit/includes/api/LinkTitlesTest.php:60
3.5526   65994224  17. ApiTestCase->doApiRequest() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php:75
3.5529   66045504  18. ApiMain->execute() /Library/WebServer/Documents/php-master/tests/phpunit/includes/api/ApiTestCase.php:97
3.5529   66045552  19. ApiMain->executeAction() /Library/WebServer/Documents/php-master/includes/api/ApiMain.php:332
3.5620   66112600  20. Wikibase\Api\LinkTitles->execute() /Library/WebServer/Documents/php-master/includes/api/ApiMain.php:899
3.5641   66140664  21. Wikibase\Api\LinkTitles->getAttemptSaveStatus() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/api/LinkTitles.php:124
3.5641   66140664  22. Wikibase\Api\ApiWikibase->attemptSaveEntity() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/api/LinkTitles.php:157
3.5650   66145512  23. Wikibase\EditEntity->attemptSave() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/api/ApiWikibase.php:589
3.5699   66146664  24. Wikibase\EditEntity->runEditFilterHooks() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/EditEntity.php:698
3.5699   66149296  25. wfRunHooks() /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/EditEntity.php:767
3.5699   66149344  26. Hooks::run() /Library/WebServer/Documents/php-master/includes/GlobalFunctions.php:4011
3.5700   66150672  27. call_user_func_array:{/Library/WebServer/Documents/php-master/includes/Hooks.php:206}() /Library/WebServer/Documents/php-master/includes/Hooks.php:206
3.5700   66151480  28. SpamBlacklistHooks::filterMergedContent() /Library/WebServer/Documents/php-master/includes/Hooks.php:206
3.5700   66151528  29. Wikibase\EntityContent->getParserOutput() /Library/WebServer/Documents/php-master/extensions/SpamBlacklist/SpamBlacklistHooks.php:28

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

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:57 AM
bzimport set Reference to bz63015.
bzimport added a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

afaik, I still have to disable SpamBlacklist when running Wikibase tests :( so this is still a problem.

would be great to have this resolved and be able to have SpamBlacklist tests run together with Wikibase in some jenkins job.

aude renamed this task from SpamBlacklist hook causes Wikibase LinkTitle api phpunit tests to fail to [Bug] SpamBlacklist hook causes Wikibase LinkTitle api phpunit tests to fail.Aug 13 2015, 1:52 PM
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:12 PM

Since https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/SpamBlacklist/+/106126/ there is no getParserOutput call in filterMergedContent

Please retest if the error is still there

LinkTitlesTest passes now. But SetClaimTest::testAddingStatementUsingFederatedProperty fails.

Change 935173 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/extensions/SpamBlacklist@master] Disable remote loading during PHPUnit tests

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

Change 935173 merged by jenkins-bot:

[mediawiki/extensions/SpamBlacklist@master] Disable remote loading during PHPUnit tests

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

tstarling claimed this task.