Skip to content

[datatables] ($store) must be of type SMW\SQLStore\SQLStore, SMW\SPARQLStore\SPARQLStore given #827

@simontaurus

Description

@simontaurus

Setup

  • MW version: 1.39.5
  • DB (MySQL etc.): MySQL 8.0.17, blazegraph
  • PHP version: 8.1.27 (apache2handler)
  • SMW version: 4.1.3
  • SRF version: 4.2.1
  • Browsers and versions (if applicable): Firefox

Issue

(@thomas-topway-it)
Sporadically pages with a datatables query throw the mentioned error, probably when a purge is executed but it's hard to reproduce

Exception caught: SMW\SQLStore\QueryEngineFactory::__construct(): Argument #1 ($store) must be of type SMW\SQLStore\SQLStore, SMW\SPARQLStore\SPARQLStore given, called in /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php on line 727

The corresponding line is now in:

$this->queryEngineFactory = new QueryEngineFactory( $this->datatables->store );

Not sure in which cases QueryResult->getStore() returns SMW\SPARQLStore\SPARQLStore in a SPARQLStore setup.

$this->store = $res->getStore();

Workaround is to catch cases where SMW\SPARQLStore\SPARQLStore is given

if ( !( $this->store instanceof \SMW\SQLStore\SQLStore ) ) return [];

Steps to reproduce

  1. Setup with SPARQLStore
  2. Page with datatable ask query
{{#ask: [[Category:A...]]
|?Modification date
|format=datatable
|datatables-searchPanes=true
|datatables-searchPanes.initCollapsed=true
|sort=Modification date
|order=desc
}}
  1. Refresh / purge the page

Expected result: No exception

Observed result: exception occurs:

[e288ba64ad67a5461d8397e1] /wiki/Item:OSW1403aaa3e5ab4... TypeError: SMW\SQLStore\QueryEngineFactory::__construct(): Argument #1 ($store) must be of type SMW\SQLStore\SQLStore, SMW\SPARQLStore\SPARQLStore given, called in /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php on line 725

Backtrace:

from /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngineFactory.php(36)
#0 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(725): SMW\SQLStore\QueryEngineFactory->__construct()
#1 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(522): SRF\DataTables->getSearchPanes()
#2 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(395): SRF\DataTables->getResultText()
#3 /var/www/html/w/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(304): SRF\DataTables->buildResult()
#4 /var/www/html/w/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(348): SMW\Query\ResultPrinters\ResultPrinter->getResult()
#5 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(370): SMWQueryProcessor::getResultFromQuery()
#6 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(202): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters()
#7 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse()
#8 /var/www/html/w/includes/parser/Parser.php(3437): SMW\ParserFunctionFactory->SMW\{closure}()
#9 /var/www/html/w/includes/parser/Parser.php(3122): Parser->callParserFunction()
#10 /var/www/html/w/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#11 /var/www/html/w/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(928): PPFrame_Hash->expand()
#12 /var/www/html/w/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(862): Scribunto_LuaEngine->doCachedExpansion()
#13 /var/www/html/w/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(399): Scribunto_LuaEngine->preprocess()
#14 /var/www/html/w/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(370): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->callback()
#15 /var/www/html/w/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(446): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->handleCall()
#16 /var/www/html/w/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(277): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->dispatch()
#17 /var/www/html/w/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(302): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->callFunction()
#18 /var/www/html/w/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(71): Scribunto_LuaEngine->executeFunctionChunk()
#19 /var/www/html/w/extensions/Scribunto/includes/Hooks.php(158): Scribunto_LuaModule->invoke()
#20 /var/www/html/w/includes/parser/Parser.php(3437): MediaWiki\Extension\Scribunto\Hooks::invokeHook()
#21 /var/www/html/w/includes/parser/Parser.php(3122): Parser->callParserFunction()
#22 /var/www/html/w/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#23 /var/www/html/w/includes/parser/Parser.php(2951): PPFrame_Hash->expand()
#24 /var/www/html/w/includes/parser/Parser.php(1609): Parser->replaceVariables()
#25 /var/www/html/w/includes/parser/Parser.php(723): Parser->internalParse()
#26 /var/www/html/w/includes/content/WikitextContentHandler.php(301): Parser->parse()
#27 /var/www/html/w/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput()
#28 /var/www/html/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#29 /var/www/html/w/includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#30 /var/www/html/w/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#31 /var/www/html/w/includes/Revision/RevisionRenderer.php(236): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#32 /var/www/html/w/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#33 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#34 /var/www/html/w/includes/Revision/RenderedRevision.php(199): call_user_func()
#35 /var/www/html/w/includes/poolcounter/PoolWorkArticleView.php(91): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#36 /var/www/html/w/includes/poolcounter/PoolWorkArticleViewCurrent.php(97): PoolWorkArticleView->renderRevision()
#37 /var/www/html/w/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleViewCurrent->doWork()
#38 /var/www/html/w/includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute()
#39 /var/www/html/w/includes/page/Article.php(714): MediaWiki\Page\ParserOutputAccess->getParserOutput()
#40 /var/www/html/w/includes/page/Article.php(528): Article->generateContentOutput()
#41 /var/www/html/w/includes/actions/ViewAction.php(78): Article->view()
#42 /var/www/html/w/includes/MediaWiki.php(542): ViewAction->show()
#43 /var/www/html/w/includes/MediaWiki.php(322): MediaWiki->performAction()
#44 /var/www/html/w/includes/MediaWiki.php(904): MediaWiki->performRequest()
#45 /var/www/html/w/includes/MediaWiki.php(562): MediaWiki->main()
#46 /var/www/html/w/index.php(50): MediaWiki->run()
#47 /var/www/html/w/index.php(46): wfIndexMain()
#48 {main}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions