Troubleshooting Common 'Safe SVG' Plugin Fatal Errors and Class Not Found Issues
Content
Understanding Common 'Safe SVG' Plugin Errors
The 'Safe SVG' plugin is a popular tool for enabling SVG uploads in WordPress while maintaining security. However, users occasionally encounter specific fatal errors that prevent the plugin from activating or functioning correctly. Based on community reports, the most frequent issues involve missing PHP extensions and autoloader conflicts.
Most Common Errors and Their Solutions
1. Class 'DOMDocument' Not Found
This is one of the most frequently reported errors, appearing in various forms throughout the support threads:
Fatal error: Uncaught Error: Class "DOMDocument" not found in .../Sanitizer.php
Why this happens: The 'Safe SVG' plugin requires the PHP XML extension (php-xml) to function. This extension provides the DOMDocument class and other XML processing capabilities essential for sanitizing SVG files.
Solution: Contact your hosting provider and request that they enable the PHP XML extension for your account. If you manage your own server, you can install it using your package manager (e.g., apt-get install php-xml on Ubuntu-based systems).
2. Class 'AllowedTags' or 'AllowedAttributes' Not Found
Fatal error: Uncaught Error: Class 'enshrinedsvgSanitizedataAllowedTags' not found
Why this happens: This error typically indicates an autoloader conflict or missing dependency files. This can occur when the plugin's vendor directory isn't properly loaded, sometimes due to custom composer configurations or unusual server directory structures.
Solution: First, try completely deleting and reinstalling the plugin. If the issue persists, check if you have any unusual directory structures or composer configurations that might interfere with the plugin's autoloader.
3. PHP 8 Compatibility Issues
Fatal error: Uncaught Error: Call to undefined function enshrinedsvgSanitizelibxml_disable_entity_loader()
Why this happens: The function libxml_disable_entity_loader() was deprecated in PHP 8.0 and removed in later versions.
Solution: Ensure you're using the latest version of 'Safe SVG', as the development team has addressed PHP 8 compatibility issues in recent updates.
4. SimpleXML Function Errors
Fatal error: Uncaught Error: Call to undefined function simplexml_load_file()
Why this happens: This error indicates that the PHP SimpleXML extension is missing from your server configuration.
Solution: Similar to the DOMDocument issue, contact your hosting provider to enable the SimpleXML extension (part of php-xml in many distributions).
General Troubleshooting Steps
- Check PHP Requirements: Ensure your server meets the plugin's PHP requirements, including the necessary extensions (XML, SimpleXML, LIBXML).
- Complete Reinstallation: Sometimes, plugin files can become corrupted during updates. Completely remove and freshly install the plugin.
- Check for Conflicts: Temporarily disable other plugins to rule out conflicts, especially those that might use similar libraries.
- Verify File Permissions: Ensure your WordPress installation has proper file permissions, particularly in the wp-content/plugins directory.
- Update Regularly: Always keep the plugin updated to the latest version to benefit from bug fixes and compatibility improvements.
When to Seek Additional Help
If these solutions don't resolve your issue, consider checking the WordPress plugin support forum for 'Safe SVG' where many similar issues have been discussed. When posting for help, include your WordPress version, PHP version, and the exact error message you're receiving.
Note: This troubleshooting guide is based on community-reported issues and solutions. The 'Safe SVG' development team continues to address these problems in plugin updates.
Related Support Threads Support
-
Fatal Errorhttps://wordpress.org/support/topic/fatal-error-3329/
-
Fatal errorhttps://wordpress.org/support/topic/fatal-error-3390/
-
Fatal Error on Upload of SVG Filehttps://wordpress.org/support/topic/fatal-error-on-upload-of-svg-file/
-
Fatal Errorhttps://wordpress.org/support/topic/fatal-error-3684/
-
Can’t install due to errorhttps://wordpress.org/support/topic/cant-install-due-to-error/
-
Not compatible with PHP7https://wordpress.org/support/topic/not-compatible-with-php7-6/
-
PHP Error after recent updatehttps://wordpress.org/support/topic/php-error-after-recent-update-2/
-
Safe SVG Not Compatible with WordPress 5.5 or Godaddy Hostinghttps://wordpress.org/support/topic/safe-svg-not-compatible-with-wordpress-5-5-or-godaddy-hosting/
-
Fatal error on network installationhttps://wordpress.org/support/topic/fatal-error-with-network-installation/
-
Error, Argument not an arrayhttps://wordpress.org/support/topic/error-argument-not-an-array/
-
https://doctor-ramani.com/https://wordpress.org/support/topic/https-doctor-ramani-com/
-
Uncaught Error: Class enshrinedsvgSanitizedataAllowedTags’ not foundhttps://wordpress.org/support/topic/uncaught-error-class-enshrinedsvgsanitizedataallowedtags-not-found/
-
Fatal PHP errorhttps://wordpress.org/support/topic/fatal-php-error-41/
-
Fatal Error Line 600 of Plugin safe-svg/safe-svg.phphttps://wordpress.org/support/topic/fatal-error-line-600-of-plugin-safe-svg-safe-svg-php/
-
Php 8 errorhttps://wordpress.org/support/topic/php-8-error-2/
-
Website not loading after update to 2.0.0https://wordpress.org/support/topic/website-not-loading-after-update-to-2-0-0/
-
Fatal error: enshrinedsvgSanitizedataAllowedTagshttps://wordpress.org/support/topic/fatal-error-enshrinedsvgsanitizedataallowedtags/
-
simplexml_load_file(): I/O warning : failed to load external entityhttps://wordpress.org/support/topic/simplexml_load_file-i-o-warning-failed-to-load-external-entity-2/
-
Fatal error in version 2.2.6https://wordpress.org/support/topic/fatal-error-in-version-2-2-6/
-
Error in Sanitizer.phphttps://wordpress.org/support/topic/error-in-sanitizer-php/
-
Can’t activate pluginhttps://wordpress.org/support/topic/cant-activate-plugin-76/
-
PHP 7.4 incompatibilityhttps://wordpress.org/support/topic/php-7-4-incompatibility/
-
Missing argument 3 for safe_svg::fix_direct_image_output()https://wordpress.org/support/topic/missing-argument-3-for-safe_svgfix_direct_image_output/
-
Fatal error: safe-svg-attributes.php on line 4https://wordpress.org/support/topic/fatal-error-safe-svg-attributes-php-on-line-4/