Open daun opened 4 months ago
:+1: for this. The root issue seems to be a buggy imagick plugin.
This probably only ever happens to SVG without width/height attributes. On the first run, its still valid XML, but getImageInfoSVG doesnt find size attributes, so Imagick is used. Imagick overrides the file contents with sh: inkscape: command not found
, which is no longer valid XML and subsequently causes a fatal error.
This happened with PHP 8.0.30 and Imagick 3.7.0, other PHP versions on the same server do not seem to suffer from the same problem.
Short description of the issue
SVGs with invalid markup will throw an exception in the page edit form when trying to calculate their size.
Expected behavior
Invalid SVGs should gracefully fall back to 0x0px size, like invalid jpeg/png images do.
Actual behavior
An exception is thrown, making it impossible to delete the invalid image from the page.
Optional: Screenshots/Links that demonstrate the issue
This is the page edit form in debug mode. In production mode, it just shows "Server error".
Optional: Suggestion for a possible fix
Check for the result of the simplexml parser when trying to read the width/height in
Pageimage.php
.I've created a PR with a suggested fix for this.
Steps to reproduce the issue
Example content of a file which triggered the problem
sh: inkscape: command not found
Setup/Environment