Skip to content

Visual editor and <bootstrap_card> crashes. #51

@CBrams

Description

@CBrams

Whenusing the <bootstrap_card> tag, whether in a template or plain in a page, the visual editor crashes with the error:
Exception caught: Typed property Parser::$mOutput must not be accessed before initialization

It still works when rendering the page, and the code editor works as well. A simple workaround is to create a template for the card yourself with content like:

<div class="card float-right" style="width: 20em;"><div class="card-header"><h4 class="card-title" style="margin-top:0;padding-top:0;">{{{header|Header}}}</h4></div><div id="bsc_card_0"><div class="card-body">
{{{content|<p>Content</p>}}}
</div></div></div>

Setup and configuration

  • MW version: 1.41.2
  • PHP: 8.1.29
  • DB (MySQL etc.): mariadb
  • Skin (version): Chameleon 4.0
  • Bootstrap: 4.5
  • BootstrapComponents: 5.0

Issue

Produces a stack trace and outputs:

Error at /var/www/html/includes/parser/Parser.php(1052)
from /var/www/html/includes/parser/Parser.php(1052)
#0 /var/www/html/extensions/BootstrapComponents/src/ParserOutputHelper.php(278): Parser->getOutput()
#1 /var/www/html/extensions/BootstrapComponents/src/ParserOutputHelper.php(135): BootstrapComponents\ParserOutputHelper->placeTrackingCategory(string)
#2 /var/www/html/extensions/BootstrapComponents/src/AbstractComponent.php(318): BootstrapComponents\ParserOutputHelper->addTrackingCategory()
#3 /var/www/html/extensions/BootstrapComponents/src/AbstractComponent.php(338): BootstrapComponents\AbstractComponent->augmentParserOutput()
#4 /var/www/html/extensions/BootstrapComponents/src/AbstractComponent.php(156): BootstrapComponents\AbstractComponent->initComponentData(BootstrapComponents\ParserRequest)
#5 /var/www/html/extensions/BootstrapComponents/src/Hooks/ParserFirstCallInit.php(163): BootstrapComponents\AbstractComponent->parseComponent(BootstrapComponents\ParserRequest)
#6 /var/www/html/includes/parser/Parser.php(3945): BootstrapComponents\Hooks\ParserFirstCallInit->BootstrapComponents\Hooks\{closure}(string, array, Parser, PPFrame_Hash)
#7 /var/www/html/includes/parser/PPFrame_Hash.php(352): Parser->extensionSubstitution(array, PPFrame_Hash, boolean)
#8 /var/www/html/includes/parser/Parser.php(2890): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#9 /var/www/html/includes/parser/Parser.php(1544): Parser->replaceVariables(string)
#10 /var/www/html/includes/parser/Parser.php(808): Parser->internalParse(string, boolean, boolean)
#11 /var/www/html/includes/parser/Parser.php(857): Parser->recursiveTagParse(string)
#12 /var/www/html/includes/parser/Parsoid/Config/DataAccess.php(370): Parser->parseExtensionTagAsTopLevelDoc(string)
#13 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TT/ExtensionHandler.php(152): MediaWiki\Parser\Parsoid\Config\DataAccess->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, string)
#14 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TT/ExtensionHandler.php(282): Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler->onExtension(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#15 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(150): Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler->onTag(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#16 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(132): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#17 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(195): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#18 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(193): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#19 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/TreeBuilder/TreeBuilderStage.php(490): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#20 [internal function]: Wikimedia\Parsoid\Wt2Html\TreeBuilder\TreeBuilderStage->processChunkily(string, array)
#21 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(988): Generator->current()
#22 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#23 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#24 /var/www/html/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(164): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#25 /var/www/html/vendor/wikimedia/parsoid/src/Parsoid.php(199): Wikimedia\Parsoid\Wikitext\ContentModelHandler->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI)
#26 /var/www/html/vendor/wikimedia/parsoid/src/Parsoid.php(240): Wikimedia\Parsoid\Parsoid->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, array)
#27 /var/www/html/includes/parser/Parsoid/ParsoidParser.php(151): Wikimedia\Parsoid\Parsoid->wikitext2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, NULL, ParserOutput)
#28 /var/www/html/includes/parser/Parsoid/ParsoidParser.php(248): MediaWiki\Parser\Parsoid\ParsoidParser->genParserOutput(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOptions)
#29 /var/www/html/includes/content/WikitextContentHandler.php(420): MediaWiki\Parser\Parsoid\ParsoidParser->parse(string, MediaWiki\Title\Title, ParserOptions, boolean, boolean, integer)
#30 /var/www/html/includes/content/ContentHandler.php(1760): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#31 /var/www/html/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#32 /var/www/html/includes/Revision/RenderedRevision.php(260): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, MediaWiki\Title\Title, integer, ParserOptions, boolean)
#33 /var/www/html/includes/Revision/RenderedRevision.php(232): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#34 /var/www/html/includes/Revision/RevisionRenderer.php(223): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#35 /var/www/html/includes/Revision/RevisionRenderer.php(164): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#36 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#37 /var/www/html/includes/Revision/RenderedRevision.php(199): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#38 /var/www/html/includes/poolcounter/PoolWorkArticleView.php(84): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#39 /var/www/html/includes/poolcounter/PoolWorkArticleViewCurrent.php(104): PoolWorkArticleView->renderRevision()
#40 /var/www/html/includes/poolcounter/PoolCounterWork.php(167): PoolWorkArticleViewCurrent->doWork()
#41 /var/www/html/includes/page/ParserOutputAccess.php(304): PoolCounterWork->execute()
#42 /var/www/html/includes/parser/Parsoid/ParsoidOutputAccess.php(227): MediaWiki\Page\ParserOutputAccess->getParserOutput(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, integer)
#43 /var/www/html/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(769): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->getParserOutput(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, integer, boolean)
#44 /var/www/html/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(577): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal(ParserOptions)
#45 /var/www/html/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(438): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#46 /var/www/html/extensions/VisualEditor/includes/DirectParsoidClient.php(157): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getHtml()
#47 /var/www/html/extensions/VisualEditor/includes/ApiParsoidTrait.php(110): MediaWiki\Extension\VisualEditor\DirectParsoidClient->getPageHtml(MediaWiki\Revision\RevisionStoreRecord, LanguageEn)
#48 /var/www/html/extensions/VisualEditor/includes/ApiVisualEditor.php(231): MediaWiki\Extension\VisualEditor\ApiVisualEditor->requestRestbasePageHtml(MediaWiki\Revision\RevisionStoreRecord)
#49 /var/www/html/includes/api/ApiMain.php(1935): MediaWiki\Extension\VisualEditor\ApiVisualEditor->execute()
#50 /var/www/html/includes/api/ApiMain.php(912): ApiMain->executeAction()
#51 /var/www/html/includes/api/ApiMain.php(883): ApiMain->executeActionWithErrorHandling()
#52 /var/www/html/api.php(95): ApiMain->execute()
#53 /var/www/html/api.php(48): wfApiMain()
#54 {main}

Steps to reproduce the observation (recommendation is to use the sandbox):
Include a tag like

<bootstrap_card header="Header" style="width: 20em;" class="float-right">
<p>Content</p>
</bootstrap_card>

In a page, and use the visual editor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions