splitbrain / dokuwiki-plugin-dw2pdf

A fork of Luigi Micco's PDF export plugin for DokuWiki
http://www.dokuwiki.org/plugin:dw2pdf
55 stars 68 forks source link

Call to undefined function Mpdf\Image\xml_parser_create() #401

Closed schplurtz closed 2 years ago

schplurtz commented 4 years ago

Hi, running 2020-05-11, DW greebo, PHP 7.3.

When I try to export a page that contains an SVG image, I get a blank page, no document and this error trace in logs

2020/05/22 11:21:17 [error] 1629#1629: *12878 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function Mpdf\Image\xml_parser_create() in /opt/webproducts/dw/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Image/Svg.php:3014
Stack trace:
#0 /opt/webproducts/dw/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php(224): Mpdf\Image\Svg->ImageSVG('<svg class="a2s...')
#1 /opt/webproducts/dw/lib/plugins/dw2pdf/DokuImageProcessorDecorator.class.php(18): Mpdf\Image\ImageProcessor->getImage('/opt/webproduct...', true, true, '/opt/webproduct...', false)
#2 /opt/webproducts/dw/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Tag/Img.php(276): dokuwiki\plugin\dw2pdf\DokuImageProcessorDecorator->getImage('/opt/webproduct...', true, true, '/opt/webproduct...', false)
#3 /opt/webproducts/dw/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Tag.php(239): Mpdf\Tag\Img->open(Array, Array, 45)
#4 /opt/webproducts/dw/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Mpdf.php(15310): Mpdf\Tag->OpenTag('IMG', Array, Array, 45)
#5 /opt/webproducts/dw/lib/plugins/dw2pdf/action.php" while reading response header from upstream, client: 192.168.255.103, server: schplurtz.mydomain.com, request: "GET /a2s?do=export_pdf HTTP/1.1", removed rest of the line...
Klap-in commented 2 years ago

For me it is unclear why it tries Mpdf\Image\xml_parser_create(), I think xml_parser_create() should be tried. You are sure the xml PHP extension is installed?

I assume this can be solved by installing the xml php extension. Otherwise an small example should be derived of the smallest piece of html plus svg that can be feeded to the mpdf library that still triggers this issue and an issue with that example should be reported at https://github.com/mpdf/mpdf

schplurtz commented 2 years ago

I am 200 % sure the php xml extension was installed at the time. This happened on a machine with permanently 2 or 3 DW instances, that I use for testing. For example, dpkg tells me I currently have php-xml, php7.4-xml, and php8.1-xml.

Anyway, I can't reproduce this issue anymore with current DokuWiki, DW extensions and PHP 7.4.

Klap-in commented 2 years ago

ok, good that it works now!