Hello everyone! I've encountered a bug using VisualEditor with Lingo installed. What happened is it wouldn't let me edit using VisualEditor throwing a following exception:
[exception] [f31f5d51fffaa701908e43c3] /mediawiki/api.php?action=visualeditor&format=json&paction=parse&page=%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0&uselang=en&editintro=&preload=&preloadparams=&formatversion=2 Error: Typed property Parser::$mOutput must not be accessed before initialization
#0 /var/lib/mediawiki/extensions/Lingo/src/LingoParser.php(393): Parser->getOutput()
#1 /var/lib/mediawiki/extensions/Lingo/src/LingoParser.php(77): Lingo\LingoParser->shouldParse()
#2 /var/lib/mediawiki/extensions/Lingo/src/Lingo.php(72): Lingo\LingoParser->parse()
#3 /var/lib/mediawiki/includes/HookContainer/HookContainer.php(161): Lingo\Lingo::Lingo\{closure}()
#4 /var/lib/mediawiki/includes/HookContainer/HookRunner.php(1179): MediaWiki\HookContainer\HookContainer->run()
#5 /var/lib/mediawiki/includes/content/ContentHandler.php(1774): MediaWiki\HookContainer\HookRunner->onContentAlterParserOutput()
#6 /var/lib/mediawiki/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#7 /var/lib/mediawiki/includes/Revision/RenderedRevision.php(259): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#8 /var/lib/mediawiki/includes/Revision/RenderedRevision.php(232): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#9 /var/lib/mediawiki/includes/Revision/RevisionRenderer.php(223): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#10 /var/lib/mediawiki/includes/Revision/RevisionRenderer.php(164): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#11 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#12 /var/lib/mediawiki/includes/Revision/RenderedRevision.php(199): call_user_func()
#13 /var/lib/mediawiki/includes/poolcounter/PoolWorkArticleView.php(84): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#14 /var/lib/mediawiki/includes/poolcounter/PoolWorkArticleViewCurrent.php(104): PoolWorkArticleView->renderRevision()
#15 /var/lib/mediawiki/includes/poolcounter/PoolCounterWork.php(167): PoolWorkArticleViewCurrent->doWork()
#16 /var/lib/mediawiki/includes/page/ParserOutputAccess.php(304): PoolCounterWork->execute()
#17 /var/lib/mediawiki/includes/parser/Parsoid/ParsoidOutputAccess.php(226): MediaWiki\Page\ParserOutputAccess->getParserOutput()
#18 /var/lib/mediawiki/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(764): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->getParserOutput()
#19 /var/lib/mediawiki/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(577): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal()
#20 /var/lib/mediawiki/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(438): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#21 /var/lib/mediawiki/extensions/VisualEditor/includes/DirectParsoidClient.php(157): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getHtml()
#22 /var/lib/mediawiki/extensions/VisualEditor/includes/ApiParsoidTrait.php(110): MediaWiki\Extension\VisualEditor\DirectParsoidClient->getPageHtml()
#23 /var/lib/mediawiki/extensions/VisualEditor/includes/ApiVisualEditor.php(231): MediaWiki\Extension\VisualEditor\ApiVisualEditor->requestRestbasePageHtml()
#24 /var/lib/mediawiki/includes/api/ApiMain.php(1935): MediaWiki\Extension\VisualEditor\ApiVisualEditor->execute()
#25 /var/lib/mediawiki/includes/api/ApiMain.php(912): ApiMain->executeAction()
#26 /var/lib/mediawiki/includes/api/ApiMain.php(883): ApiMain->executeActionWithErrorHandling()
#27 /var/lib/mediawiki/api.php(95): ApiMain->execute()
#28 /var/lib/mediawiki/api.php(48): wfApiMain()
#29 {main}
I'm running MediaWiki 1.41.1 and Lingo 3.1.1. As a temporal dirty workaround I added some lines in Lingo/src/LingoParser.php that check whether Parser::$mOutput was initialized and it seems to be working:
/**
* @param Parser $parser
* @return bool
*/
private function shouldParse( $parser ) {
global $wgexLingoUseNamespaces;
if ( !( $parser instanceof Parser || $parser instanceof StubObject ) ) {
return false;
}
$reflectionClass = new \ReflectionClass(Parser::class);
if ( !$reflectionClass->getProperty( 'mOutput' )->isInitialized( $parser ) ) {
return false;
}
Is there any solution to this? Thanks in advance!