SemanticMediaWiki / SemanticMediaWiki

🔗 Semantic MediaWiki turns MediaWiki into a knowledge management platform with query and export capabilities
https://www.semantic-mediawiki.org
Other
516 stars 228 forks source link

Error: Call to a member function getCanonicalDiWikiPage() on null #5738

Open krabina opened 1 month ago

krabina commented 1 month ago

Setup

Issue

I am getting the following error on some pages. Have not yet figured out why. Error: Call to a member function getCanonicalDiWikiPage() on null (stack trace below)

It happens on Property pages and shows when I try to access the page in the wiki or also when I try a rebuildData.

 /Attribut:Lizenztyp Error: Call to a member function getCanonicalDiWikiPage() on null

Backtrace:

from /extensions/SemanticMediaWiki/src/DataValues/PropertyValue.php(299)
#0 /extensions/SemanticMediaWiki/src/DataValues/PropertyValue.php(257): SMW\DataValues\PropertyValue->getWikiPageValue()
#1 /extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(493): SMW\DataValues\PropertyValue->setLinkAttributes()
#2 /extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(386): SMW\Parser\InTextAnnotationParser->makePropertyLink()
#3 /extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(353): SMW\Parser\InTextAnnotationParser->process()
#4 [internal function]: SMW\Parser\InTextAnnotationParser->preprocess()
#5 /extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(184): preg_replace_callback()
#6 /extensions/SemanticMediaWiki/src/MediaWiki/Hooks/InternalParseBeforeLinks.php(145): SMW\Parser\InTextAnnotationParser->parse()
#7 /extensions/SemanticMediaWiki/src/MediaWiki/Hooks/InternalParseBeforeLinks.php(76): SMW\MediaWiki\Hooks\InternalParseBeforeLinks->performUpdate()
#8 /extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php(581): SMW\MediaWiki\Hooks\InternalParseBeforeLinks->process()
#9 /includes/HookContainer/HookContainer.php(338): SMW\MediaWiki\Hooks->onInternalParseBeforeLinks()
#10 /includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#11 /includes/HookContainer/HookRunner.php(2181): MediaWiki\HookContainer\HookContainer->run()
#12 /includes/parser/Parser.php(1625): MediaWiki\HookContainer\HookRunner->onInternalParseBeforeLinks()
#13 /includes/parser/Parser.php(723): Parser->internalParse()
#14 /includes/content/WikitextContentHandler.php(301): Parser->parse()
#15 /includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput()
#16 /includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#17 /includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#18 /includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#19 /includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#20 /includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#21 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#22 /includes/Revision/RenderedRevision.php(199): call_user_func()
#23 /includes/poolcounter/PoolWorkArticleView.php(91): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#24 /includes/poolcounter/PoolWorkArticleViewCurrent.php(97): PoolWorkArticleView->renderRevision()
#25 /includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleViewCurrent->doWork()
#26 /includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute()
#27 /includes/page/WikiPage.php(1291): MediaWiki\Page\ParserOutputAccess->getParserOutput()
#28 /extensions/SemanticMediaWiki/src/MediaWiki/Page/PropertyPage.php(132): WikiPage->getParserOutput()
#29 /extensions/SemanticMediaWiki/src/MediaWiki/Page/PropertyPage.php(110): SMW\MediaWiki\Page\PropertyPage->getSemanticData()
#30 /extensions/SemanticMediaWiki/src/MediaWiki/Page/Page.php(94): SMW\MediaWiki\Page\PropertyPage->initHtml()
#31 /includes/actions/ViewAction.php(78): SMW\MediaWiki\Page\Page->view()
#32 /includes/MediaWiki.php(542): ViewAction->show()
#33 /includes/MediaWiki.php(322): MediaWiki->performAction()
#34 /includes/MediaWiki.php(904): MediaWiki->performRequest()
#35 /includes/MediaWiki.php(562): MediaWiki->main()
#36 /index.php(50): MediaWiki->run()
#37 /index.php(46): wfIndexMain()
#38 {main}
krabina commented 1 month ago

Don't really know why this happened (the content of the properties where this happend did not have anything special. Solution was to delete all the pages, the run rebuildData.php. Then I added the pages again (they were actually from an CSV import via DataTransfer). Now it is working again.

Closing this, because is might have been some hickkup in my installation.

krabina commented 1 month ago

Tried different versions of DataTransfer, because imporing data was not working. Only some page were importet. Running runJobs.php sometimes stopped with:

error=RuntimeException: SMW\SemanticData is already in use, please clear the callable first! php

krabina commented 1 month ago

Tried o import in another installation, which worked right away. Form there I exported the pages (they are property pages) to MediaWiki XML and imported this in my installation. Now a similar error is shown. (see below)

You can see the files I exported from the (working) wiki: https://test.knowledge.wiki/index.php?title=Spezial%3ABeitr%C3%A4ge&target=Admin&namespace=all&tagfilter=&start=2024-10-19&end=2024-10-19&limit=250

[82c9e458b6c8cbae2a8c228c] /index.php?title=Spezial:Importieren&action=submit Error: Call to a member function getCanonicalDiWikiPage() on null

Backtrace:

from extensions/SemanticMediaWiki/src/DataValues/PropertyValue.php(299)
#0 extensions/SemanticMediaWiki/src/DataValues/PropertyValue.php(257): SMW\DataValues\PropertyValue->getWikiPageValue()
#1 extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(493): SMW\DataValues\PropertyValue->setLinkAttributes()
#2 extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(386): SMW\Parser\InTextAnnotationParser->makePropertyLink()
#3 extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(353): SMW\Parser\InTextAnnotationParser->process()
#4 [internal function]: SMW\Parser\InTextAnnotationParser->preprocess()
#5 extensions/SemanticMediaWiki/src/Parser/InTextAnnotationParser.php(184): preg_replace_callback()
#6 extensions/SemanticMediaWiki/src/MediaWiki/Hooks/InternalParseBeforeLinks.php(145): SMW\Parser\InTextAnnotationParser->parse()
#7 extensions/SemanticMediaWiki/src/MediaWiki/Hooks/InternalParseBeforeLinks.php(76): SMW\MediaWiki\Hooks\InternalParseBeforeLinks->performUpdate()
#8 extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php(581): SMW\MediaWiki\Hooks\InternalParseBeforeLinks->process()
#9 includes/HookContainer/HookContainer.php(338): SMW\MediaWiki\Hooks->onInternalParseBeforeLinks()
#10 includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#11 includes/HookContainer/HookRunner.php(2181): MediaWiki\HookContainer\HookContainer->run()
#12 includes/parser/Parser.php(1625): MediaWiki\HookContainer\HookRunner->onInternalParseBeforeLinks()
#13 includes/parser/Parser.php(723): Parser->internalParse()
#14 includes/content/WikitextContentHandler.php(301): Parser->parse()
#15 includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput()
#16 includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#17 includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#18 includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#19 includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#20 includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#21 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#22 includes/Revision/RenderedRevision.php(199): call_user_func()
#23 includes/Storage/DerivedPageDataUpdater.php(1438): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#24 includes/Storage/DerivedPageDataUpdater.php(1817): MediaWiki\Storage\DerivedPageDataUpdater->getCanonicalParserOutput()
#25 includes/Storage/DerivedPageDataUpdater.php(1715): MediaWiki\Storage\DerivedPageDataUpdater->doParserCacheUpdate()
#26 includes/Storage/DerivedPageDataUpdater.php(1568): MediaWiki\Storage\DerivedPageDataUpdater->triggerParserCacheUpdate()
#27 includes/import/ImportableOldRevisionImporter.php(241): MediaWiki\Storage\DerivedPageDataUpdater->doUpdates()
#28 includes/import/WikiRevision.php(682): ImportableOldRevisionImporter->import()
#29 includes/import/WikiImporter.php(520): WikiRevision->importOldRevision()
#30 includes/import/WikiImporter.php(649): WikiImporter->importRevision()
#31 includes/import/WikiImporter.php(1151): WikiImporter->revisionCallback()
#32 includes/import/WikiImporter.php(1017): WikiImporter->processRevision()
#33 includes/import/WikiImporter.php(949): WikiImporter->handleRevision()
#34 includes/import/WikiImporter.php(767): WikiImporter->handlePage()
#35 includes/specials/SpecialImport.php(239): WikiImporter->doImport()
#36 includes/specials/SpecialImport.php(112): SpecialImport->doImport()
#37 includes/specialpage/SpecialPage.php(701): SpecialImport->execute()
#38 includes/specialpage/SpecialPageFactory.php(1428): SpecialPage->run()
#39 includes/MediaWiki.php(316): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#40 includes/MediaWiki.php(904): MediaWiki->performRequest()
#41 includes/MediaWiki.php(562): MediaWiki->main()
#42 index.php(50): MediaWiki->run()
#43 index.php(46): wfIndexMain()
#44 {main}
krabina commented 3 weeks ago

The issue was caused by a property name with a '.' in the name. This is not allowed in SMW, but no info or error message is being displayed on the property page (that gets created correctly).

kghbln commented 2 weeks ago

The script should fail more gracefully here. However, you should not have been able to add an annotation and rather get a processing error note on the wiki: See https://sandbox.semantic-mediawiki.net/wiki/Sp%C3%A9cial:Parcourir/:Issue-2F5738.

What worries me more is that the wiki ignores the https://www.semantic-mediawiki.org/wiki/Help:$smwgPropertyInvalidCharacterList configuration parameter. On the test page mentioned, I could annotate the property Foo,Bar. :(