-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Shapes SVG include PHP Parse Error #9693
Copy link
Copy link
Closed
Labels
bugIndicates a bug with one or multiple components.Indicates a bug with one or multiple components.element/settings/shape-dividerReferences the top and bottom element Shape Divider feature.References the top and bottom element Shape Divider feature.status/mergedIndicates when a Pull Request has been merged to a Release.Indicates when a Pull Request has been merged to a Release.
Milestone
Metadata
Metadata
Assignees
Labels
bugIndicates a bug with one or multiple components.Indicates a bug with one or multiple components.element/settings/shape-dividerReferences the top and bottom element Shape Divider feature.References the top and bottom element Shape Divider feature.status/mergedIndicates when a Pull Request has been merged to a Release.Indicates when a Pull Request has been merged to a Release.
Prerequisites
Description
I've created a plugin which add custom SVG shapes to the section setting "Shape divider".
If the uploaded SVG file contain
<?xml version="1.0" encoding="UTF-8"?>, PHP return a parse error :PHP Parse error: syntax error, unexpected 'version' (T_STRING)It can be easily fixed by replacing
includebyecho file_get_contentsin theprint_shape_dividerfunction (https://github.com/elementor/elementor/blob/master/includes/elements/section.php#L1533).The XML declaration in the SVG file is important because of security reasons.
Steps to reproduce
Add a custom SVG shape, the SVG file must begin with
<?xml version="1.0" encoding="UTF-8"?>For example :
<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 111.859 500 42.943"><path d="M.366 156.606h498.56v-45.71L.366 156.606z" fill="#bada55"></path></svg>Isolating the problem