Merge pull request #7607 from patricknelson/issue-7606-svg-image-tags

FIX: Prevent crash when saving page with <img> that has an SVG source.
This commit is contained in:
Daniel Hensby 2017-11-16 12:12:49 +00:00 committed by GitHub
commit c96ed89cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,8 @@ class HtmlEditorField extends TextareaField {
$img->setAttribute('src', preg_replace('/([^\?]*)\?r=[0-9]+$/i', '$1', $img->getAttribute('src'))); $img->setAttribute('src', preg_replace('/([^\?]*)\?r=[0-9]+$/i', '$1', $img->getAttribute('src')));
// Resample the images if the width & height have changed. // Resample the images if the width & height have changed.
if($image = File::find(urldecode(Director::makeRelative($img->getAttribute('src'))))){ $image = File::find(urldecode(Director::makeRelative($img->getAttribute('src'))));
if($image instanceof Image){
$width = (int)$img->getAttribute('width'); $width = (int)$img->getAttribute('width');
$height = (int)$img->getAttribute('height'); $height = (int)$img->getAttribute('height');