Hotfix For issue with amazon-s3-and-cloudfront and simplexml_load_file
-
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)
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.