Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maps with polygons break visual editor #758

Open
prudloff-insite opened this issue Nov 21, 2023 · 0 comments · May be fixed by #759
Open

Maps with polygons break visual editor #758

prudloff-insite opened this issue Nov 21, 2023 · 0 comments · May be fixed by #759
Labels

Comments

@prudloff-insite
Copy link
Contributor

prudloff-insite commented Nov 21, 2023

Setup

  • Maps version: 10.1.0
  • MW version: 1.39.5
  • PHP version: 7.4.33
  • SMW version (if applicable): 4.1.2

Issue

We have a template that prints a semantic map containing polygons.
When using the visual editor on a page containing this template, the initial AJAX request to /api.php?action=visualeditor&format=json&paction=parse... fails with this error:

Exception caught: Call to a member function getUserIdentity() on null

Error at /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(1204)
from /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(1204)
#0 /srv/www/archi-mediawiki-php74/extensions/Maps/src/Presentation/WikitextParser.php(26): Parser->getUserIdentity()
#1 /srv/www/archi-mediawiki-php74/extensions/Maps/src/Presentation/ElementJsonSerializer.php(26): Maps\\Presentation\\WikitextParser->wikitextToHtml()
#2 /srv/www/archi-mediawiki-php74/extensions/Maps/src/Presentation/ElementJsonSerializer.php(20): Maps\\Presentation\\ElementJsonSerializer->titleAndText()
#3 /srv/www/archi-mediawiki-php74/extensions/Maps/src/Map/SemanticFormat/MapPrinter.php(160): Maps\\Presentation\\ElementJsonSerializer->elementToJson()
#4 [internal function]: Maps\\Map\\SemanticFormat\\MapPrinter->Maps\\Map\\SemanticFormat\\{closure}()
#5 /srv/www/archi-mediawiki-php74/extensions/Maps/src/Map/SemanticFormat/MapPrinter.php(159): array_map()
#6 /srv/www/archi-mediawiki-php74/extensions/Maps/src/Map/SemanticFormat/MapPrinter.php(114): Maps\\Map\\SemanticFormat\\MapPrinter->elementsToJson()
#7 /srv/www/archi-mediawiki-php74/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(339): Maps\\Map\\SemanticFormat\\MapPrinter->getResultText()
#8 /srv/www/archi-mediawiki-php74/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(304): SMW\\Query\\ResultPrinters\\ResultPrinter->buildResult()
#9 /srv/www/archi-mediawiki-php74/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(348): SMW\\Query\\ResultPrinters\\ResultPrinter->getResult()
#10 /srv/www/archi-mediawiki-php74/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(367): SMWQueryProcessor::getResultFromQuery()
#11 /srv/www/archi-mediawiki-php74/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(202): SMW\\ParserFunctions\\AskParserFunction->doFetchResultsFromFunctionParameters()
#12 /srv/www/archi-mediawiki-php74/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\\ParserFunctions\\AskParserFunction->parse()
#13 /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(3437): SMW\\ParserFunctionFactory->SMW\\{closure}()
#14 /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(3122): Parser->callParserFunction()
#15 /srv/www/archi-mediawiki-php74/core/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#16 /srv/www/archi-mediawiki-php74/extensions/ParserFunctions/includes/ParserFunctions.php(105): PPFrame_Hash->expand()
#17 /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(3437): MediaWiki\\Extension\\ParserFunctions\\ParserFunctions::if()
#18 /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(3122): Parser->callParserFunction()
#19 /srv/www/archi-mediawiki-php74/core/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#20 /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(3313): PPFrame_Hash->expand()
#21 /srv/www/archi-mediawiki-php74/core/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#22 /srv/www/archi-mediawiki-php74/core/includes/parser/Parser.php(2951): PPFrame_Hash->expand()
#23 /srv/www/archi-mediawiki-php74/core/includes/parser/Parsoid/Config/DataAccess.php(377): Parser->replaceVariables()
#24 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wikitext/Wikitext.php(43): MediaWiki\\Parser\\Parsoid\\Config\\DataAccess->preprocessWikitext()
#25 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1108): Wikimedia\\Parsoid\\Wikitext\\Wikitext::preprocess()
#26 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1151): Wikimedia\\Parsoid\\Wt2Html\\TT\\TemplateHandler->expandTemplate()
#27 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1196): Wikimedia\\Parsoid\\Wt2Html\\TT\\TemplateHandler->onTemplate()
#28 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(150): Wikimedia\\Parsoid\\Wt2Html\\TT\\TemplateHandler->onTag()
#29 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(132): Wikimedia\\Parsoid\\Wt2Html\\TT\\TokenHandler->process()
#30 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(195): Wikimedia\\Parsoid\\Wt2Html\\TokenTransformManager->processChunk()
#31 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(193): Wikimedia\\Parsoid\\Wt2Html\\TokenTransformManager->processChunkily()
#32 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/TreeBuilder/TreeBuilderStage.php(487): Wikimedia\\Parsoid\\Wt2Html\\TokenTransformManager->processChunkily()
#33 [internal function]: Wikimedia\\Parsoid\\Wt2Html\\TreeBuilder\\TreeBuilderStage->processChunkily()
#34 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(904): Generator->current()
#35 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\\Parsoid\\Wt2Html\\DOMPostProcessor->processChunkily()
#36 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(308): Wikimedia\\Parsoid\\Wt2Html\\ParserPipeline->parseChunkily()
#37 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(123): Wikimedia\\Parsoid\\Wt2Html\\ParserPipelineFactory->parse()
#38 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Parsoid.php(172): Wikimedia\\Parsoid\\Wikitext\\ContentModelHandler->toDOM()
#39 /srv/www/archi-mediawiki-php74/vendor/wikimedia/parsoid/src/Parsoid.php(210): Wikimedia\\Parsoid\\Parsoid->parseWikitext()
#40 /srv/www/archi-mediawiki-php74/extensions/VisualEditor/includes/VisualEditorParsoidClient.php(123): Wikimedia\\Parsoid\\Parsoid->wikitext2html()
#41 /srv/www/archi-mediawiki-php74/extensions/VisualEditor/includes/ParsoidHelper.php(224): MediaWiki\\Extension\\VisualEditor\\VisualEditorParsoidClient->getPageHtml()
#42 /srv/www/archi-mediawiki-php74/extensions/VisualEditor/includes/ApiParsoidTrait.php(134): MediaWiki\\Extension\\VisualEditor\\ParsoidHelper->requestRestbasePageHtml()
#43 /srv/www/archi-mediawiki-php74/extensions/VisualEditor/includes/ApiVisualEditor.php(279): MediaWiki\\Extension\\VisualEditor\\ApiVisualEditor->requestRestbasePageHtml()
#44 /srv/www/archi-mediawiki-php74/core/includes/api/ApiMain.php(1900): MediaWiki\\Extension\\VisualEditor\\ApiVisualEditor->execute()
#45 /srv/www/archi-mediawiki-php74/core/includes/api/ApiMain.php(875): ApiMain->executeAction()
#46 /srv/www/archi-mediawiki-php74/core/includes/api/ApiMain.php(846): ApiMain->executeActionWithErrorHandling()
#47 /srv/www/archi-mediawiki-php74/core/api.php(90): ApiMain->execute()
#48 /srv/www/archi-mediawiki-php74/core/api.php(45): wfApiMain()
#49 {main}

This seems to happen because the parser instance used by WikitextParser returns null when calling getOptions() on it.

I tried to create a simple example on the sandbox (https://sandbox.semantic-mediawiki.net/wiki/Test_Map_with_polygons) but could not reproduce the error.

@prudloff-insite prudloff-insite linked a pull request Nov 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant