Page MenuHomePhabricator

DrawioEditor: ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install NativeSvgHandler and DrawioEditor extensions
  • Edit a page and add a draw.io chart:
{{#drawio:PNGBugTestdiagramm|type=png}}

What happens?:

Internal error occurs:

[51c5e0665161bf9b610f4a6a] /e-learning/index.php/Draw_IO_Funktioniert_nicht ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty

Backtrace:

from /var/www/html/extensions/DrawioEditor/src/MXDocumentExtractor/Base.php(105)
#0 /var/www/html/extensions/DrawioEditor/src/MXDocumentExtractor/Base.php(105): DOMDocument->loadXML(string)
#1 /var/www/html/extensions/DrawioEditor/src/MXDocumentExtractor/Base.php(36): MediaWiki\Extension\DrawioEditor\MXDocumentExtractor\Base->getDiagramDOM(DOMDocument)
#2 /var/www/html/extensions/DrawioEditor/src/DrawioEditor.php(264): MediaWiki\Extension\DrawioEditor\MXDocumentExtractor\Base->extractMXDocument(LocalFile)
#3 /var/www/html/extensions/DrawioEditor/src/DrawioEditor.php(74): MediaWiki\Extension\DrawioEditor\DrawioEditor->parse(Parser, string, array)
#4 /var/www/html/includes/parser/Parser.php(3443): MediaWiki\Extension\DrawioEditor\DrawioEditor->parseLegacyParserFunc(Parser, string, string)
#5 /var/www/html/includes/parser/Parser.php(3126): Parser->callParserFunction(PPFrame_Hash, string, array)
#6 /var/www/html/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPFrame_Hash)
#7 /var/www/html/includes/parser/Parser.php(2955): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#8 /var/www/html/includes/parser/Parser.php(1610): Parser->replaceVariables(string)
#9 /var/www/html/includes/parser/Parser.php(724): Parser->internalParse(string)
#10 /var/www/html/includes/content/WikitextContentHandler.php(301): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#11 /var/www/html/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#12 /var/www/html/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#13 /var/www/html/includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, integer, ParserOptions, boolean)
#14 /var/www/html/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#15 /var/www/html/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#16 /var/www/html/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#17 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#18 /var/www/html/includes/Revision/RenderedRevision.php(199): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#19 /var/www/html/includes/poolcounter/PoolWorkArticleView.php(91): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#20 /var/www/html/includes/poolcounter/PoolWorkArticleViewCurrent.php(97): PoolWorkArticleView->renderRevision()
#21 /var/www/html/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleViewCurrent->doWork()
#22 /var/www/html/includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute()
#23 /var/www/html/includes/page/Article.php(714): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiPage, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, integer)
#24 /var/www/html/includes/page/Article.php(528): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#25 /var/www/html/includes/actions/ViewAction.php(78): Article->view()
#26 /var/www/html/includes/MediaWiki.php(542): ViewAction->show()
#27 /var/www/html/includes/MediaWiki.php(322): MediaWiki->performAction(Article, Title)
#28 /var/www/html/includes/MediaWiki.php(904): MediaWiki->performRequest()
#29 /var/www/html/includes/MediaWiki.php(562): MediaWiki->main()
#30 /var/www/html/index.php(50): MediaWiki->run()
#31 /var/www/html/index.php(46): wfIndexMain()
#32 {main}

What should have happened instead?:

To show the draw.io chart without errors

Software version (skip for WMF-hosted wikis like Wikipedia):

MediaWiki 1.39.3
PHP 8.1.18 (apache2handler)
MySQL 5.7.41
DrawioEditor 2.0.0-alpha (a4ffafa)
NativeSvgHandler 1.4.0 (95310ed)

Other information (browser name/version, screenshots, etc.):

Event Timeline

S0ring claimed this task.

Adding the #drawio tag without type is working

The extension is working fine with SVG only (which is set by default and recommended), but not with PNG (which is supported).
Here the documentation: https://github.com/wikimedia/mediawiki-extensions-DrawioEditor#file-type

The error occurs even after setting $wgDrawioEditorImageType to png in LocalSettings.php:

$wgDrawioEditorImageType = 'png';
S0ring claimed this task.

After installing the newer version using git, the error has disappeared.
git clone https://github.com/wikimedia/mediawiki-extensions-DrawioEditor DrawioEditor

DrawioEditor 2.0.0-alpha (928553c) 08:32, 15 May 2023