Problem to edit svg in the panel

Hi,

When I load a svg file in the panel, I can’t edit it.

The error message is:

Call to undefined function simplexml_load_string()

File: /.../www/kirby/vendor/getkirby/toolkit/lib/media.php
Line: 453

I use Kirby 2.5.6 but the error occured with the previous version

Hm, is the simplexml extension installed on your server? What is your PHP version?

My PHP version is 7.0

Does simplexml extension correspond to the php7.0-xml package?

Probably depends on the OS, but generally, yes, Simplexml should be part of that package.

I’m checking my Linux server right know.

php7.0-xml package should be installed (I had it to my shell deployment script) … but in fact wasn’t, I don’t know why :-/
So now with the php7.0-xml package installed, no more error message, you were right, thanks a lot :wink:

However, I don’t see any preview of the svg, do I miss another php extension?

What do you get in the source code for that svg in the file viewer?

This occurs for all the svg files.

You want me to post the source code of one of them?

Yep, is there anything in the source code for these svgs?

it might also make sense to check the network tag to see with what type of header these files are sent.

Here is the source code of one of them

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
	.st0{fill:#FFFFFF;}
	.st1{fill:#CCE7FF;}
	.st2{fill:none;stroke:#1078FF;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
	.st3{fill:none;}
</style>
<g id="Duotone">
	<polygon class="st0" points="19,4.5 16,4.5 12.1,8.1 12.1,8.1 10.5,6.5 0.5,6.5 8.1,12.1 8.1,12.1 0.5,20 10.5,15.5 15.5,15.5 
		17.5,12 17.5,10 20.5,6.5 	"/>
	<polygon class="st1" points="18,6.5 15,10 15,12 12,12 7.5,8.5 3.2,8.5 8.1,12.1 8.1,12.1 0.5,20 10.5,15.5 15.5,15.5 17.5,12 
		17.5,10 20.5,6.5 	"/>
	<polyline class="st2" points="13,9 10.5,6.5 0.5,6.5 10,13.5 	"/>
	<polyline class="st2" points="12.1,8.1 16,4.5 19,4.5 20.5,6.5 17.5,10 17.5,12 15.5,15.5 10.5,15.5 0.5,20 8.1,12.1 	"/>
	<line class="st2" x1="17.5" y1="6.5" x2="17.5" y2="7"/>
	<line class="st2" x1="20.5" y1="6.5" x2="23.5" y2="6.5"/>
</g>
<g id="Frames-24px">
	<rect class="st3" width="24" height="24"/>
</g>
</svg>

It seems it come from security headers I added in my server config file.
When I remove them and clear the cache, the preview come back …

The culpit is:

# Disallow the site to be rendered within a frame (clickjacking protection)
X-Frame-Options "DENY"

I’m going to replace “DENY” by “SAMEORIGIN”, it’s less restrictive and solve the problem

# Disallow the site to be rendered within a frame (clickjacking protection)
X-Frame-Options "SAMEORIGIN"