Page MenuHomePhabricator

Conflict between Extension:PageForms and Extension:Lingo
Open, Needs TriagePublic


I have observed a stange behavior when using Extension:PageForms and Extension:Lingo together.

Having a page with the wikitext

==Some Heading==

will result in

MWException from line 310 of includes/parser/ParserOutput.php: Bad parser output text.


#0 [internal function]: ParserOutput->{closure}(array)
#1 includes/parser/ParserOutput.php(320): preg_replace_callback(string, Closure, string)
#2 extensions/Lingo/src/LingoParser.php(205): ParserOutput->getText()
#3 extensions/Lingo/src/LingoParser.php(83): Lingo\LingoParser->realParse(Parser)
#4 extensions/Lingo/src/Lingo.php(53): Lingo\LingoParser->parse(Parser)
#5 includes/Hooks.php(177): Lingo\Lingo::Lingo\{closure}(WikitextContent, Title, ParserOutput)
#6 includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#7 includes/content/AbstractContent.php(520): Hooks::run(string, array)
#8 extensions/BlueSpiceEditNotifyConnector/includes/BlueSpiceEditNotifyConnector.php(252): AbstractContent->getParserOutput(Title)
#9 includes/Hooks.php(177): BlueSpiceEditNotifyConnector::onPageContentSave(WikiPage, User, WikitextContent, string, integer, NULL, NULL, integer, Status)
#10 includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#11 includes/page/WikiPage.php(1618): Hooks::run(string, array)
#12 includes/EditPage.php(2214): WikiPage->doEditContent(WikitextContent, string, integer, boolean, User, string, array, integer)
#13 includes/EditPage.php(1506): EditPage->internalAttemptSave(array, boolean)
#14 includes/EditPage.php(652): EditPage->attemptSave(array)
#15 includes/actions/EditAction.php(60): EditPage->edit()
#16 includes/actions/SubmitAction.php(38): EditAction->show()
#17 includes/MediaWiki.php(500): SubmitAction->show()
#18 includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#19 includes/MediaWiki.php(861): MediaWiki->performRequest()
#20 includes/MediaWiki.php(524): MediaWiki->main()
#21 index.php(42): MediaWiki->run()
#22 {main}


==Some Heading==

will work as expected.


  • PHP 7.2
  • MediaWiki 1.31
  • Extension:PageForms 4.6 and master
  • Extension:Lingo 3.1.1

Event Timeline

Osnard created this task.Jan 14 2020, 7:36 AM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptJan 14 2020, 7:36 AM

In the early times of PageForms a deep-copy of $wgParser used. But this got removed when the Parser started to contain closures, that can not be serialized [1]. The author of that patch, @Foxtrott, states

This will likely lead to the old problematic behaviour, which will have to be fixed without using serialization

The call to Parser::clearState also got removed in that patch, but got added back just a few month later [2].


I have created a patch that again "clones" the global Parser object [1]. This solves the issue described above, but it seems to break some tests. I will look into this.


Okay, it looks like the tests were not broken by my change but are broken in current master as well.

@Yaron_Koren Thanks for merging 564517. Could you please also review 564473?

Thanks for letting me know - I don't think I saw that other patch before.