svg_image_field integration can trigger warnings in simplexml_load_string() call

Created on 19 March 2024, 8 months ago
Updated 2 April 2024, 8 months ago

Problem/Motivation

In MediaHelper::getSvgDimensions, if simplexml_load_string() takes issue with markup inside of an SVG file, its warnings may clutter up error logging.

Steps to reproduce

For example, try the attached invalid-xml.svg (gzipped).

1. On a site with the svg_image_field module enabled, upload this file to a vector image media bundle.
2. Create a node type with a media reference field that allows the same vector image media type.
3. In the node's display settings, display the media field using the Media Helper - Rendered Image widget.
4. In a node of this type, select this media item in a field for SVG images, then view the node.

Proposed resolution

I don't think there's much reason to let these parsing issues get logged. We can pass LIBXML_NOWARNING to suppress warnings when loading the SVG file.

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bvoynick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024