When an SVG is uploaded, the plugin calls simplexml_load_file to retrieve the SVG dimensions from the file. However, if the simplexml PHP extension is not installed, the plugin will crash while attempting to generate the metadata for the image.
If you use the media gallery to upload a file then the upload process won't complete and WordPress will throw a generic error message:
The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.
However if you upload an image via the REST API, the request will fail with a 500 HTTP error but the image will still be successfully uploaded without metadata. This becomes a problem because you won't be able to access the media gallery afterwards since the plugin will attempt to regenerate the metadata on the fly and crash.
Steps to Reproduce
Upload an image via the REST API. Request will fail with a 500 error.
File will exist in the uploads folder and in the wp_posts table, but there won't be a _wp_attachment_metadata in wp_postmeta.
Try to access the media gallery.
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the bug
When an SVG is uploaded, the plugin calls
simplexml_load_file
to retrieve the SVG dimensions from the file. However, if thesimplexml
PHP extension is not installed, the plugin will crash while attempting to generate the metadata for the image.If you use the media gallery to upload a file then the upload process won't complete and WordPress will throw a generic error message:
However if you upload an image via the REST API, the request will fail with a 500 HTTP error but the image will still be successfully uploaded without metadata. This becomes a problem because you won't be able to access the media gallery afterwards since the plugin will attempt to regenerate the metadata on the fly and crash.
Steps to Reproduce
wp_posts
table, but there won't be a_wp_attachment_metadata
inwp_postmeta
.Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct