• Resolved abstractourist

    (@abstractourist)


    Hello together,

    I’m running svg-support with amazon-s3-and-cloudfront to upload svg media to s3. After some updates, the media library stopped working. Deactivating svg-support would let the media library function again. The error log contains entries like the following:

    
    PHP Warning:  simplexml_load_file(): s3eucentral1://timumcms/
    wp-content/uploads/sites/6/2016/08/15155314/logo_timum_333333.svg:1: parser error : Start tag expected, '<' not found in /var/app/current/wp-content/plugins/svg-support/functions/attachment-modal.php on line 34, referer: https://www.timum.de/wp-admin/upload.php
    
    PHP Warning:  simplexml_load_file(): \x1f\x8b\b in /var/app/current/wp-content/plugins/svg-support/functions/attachment-modal.php on line 34, referer: https://www.timum.de/wp-admin/upload.php
    
    PHP Warning:  simplexml_load_file(): ^ in /var/app/current/wp-content/plugins/svg-support/functions/attachment-modal.php on line 34, referer: https://www.timum.de/wp-admin/upload.php
    
    PHP Fatal error:  Call to a member function attributes() on boolean in /var/app/current/wp-content/plugins/svg-support/functions/attachment-modal.php on line 35, referer: https://www.timum.de/wp-admin/upload.php
    

    Without much debugging, I hacked together the following and the media library is working again with svg-support enabled.

    
    // attachment-modal.php:32
    function bodhi_svgs_get_dimensions( $svg ) {
    
    	$svg = simplexml_load_file( $svg );
    	if($svg === FALSE) {
    		$width = '0';
    		$height = '0';
    	} else {
    		$attributes = $svg->attributes();
    		$width = (string) $attributes->width;
    		$height = (string) $attributes->height;
    	}
    	return (object) array( 'width' => $width, 'height' => $height );
    
    }

    Maybe you want to apply this as patch or build a patch for my issue based on that.

    Enjoy your day,
    Basti

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Benbodhi

    (@benbodhi)

    Hi there,

    Thanks so much for pointing out this issue and providing your fix!
    I will look at including this after testing in a few environments.
    With any luck it actually will fix the errors some others are getting with the media library when images are missing or are external.

    Thanks again, I will try and get to this as soon as possible.

    Cheers
    Ben

    @abstractourist Thank you, you saved my day! This fix should be posted on Stackoverflow too!

    Alex

    Plugin Author Benbodhi

    (@benbodhi)

    This will be addressed in the next release. Thanks for your support and patience guys!

    Plugin Author Benbodhi

    (@benbodhi)

    I have updated the plugin to version 2.3.7 with this fix included.

    Please let me know if you have further issues after updating.

    Thanks for your patience ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hotfix For issue with amazon-s3-and-cloudfront and simplexml_load_file’ is closed to new replies.