SVG images not loading after updating to Elementor 3.19.1
-
Hi team,
We have several websites hosted at WPVIP, all of them using Elementor. We detected an unusual behavior with SVG icons on the websites: no matter what we do, the icons are not loaded. Even when we load them to the backend, the SVG icons gets removed right after adding them.
I have been in contact with WPVIP team and they found the culprit at this function:
public static function file_get_contents( $file, ...$args ) { if ( realpath( $file ) === false || ! is_file( $file ) || ! is_readable( $file ) ) { return false; }
elementor/includes/utils.php line 811
The function file_get_contents() in Elementor is returning?
false
?because?realpath( $file )
?is returning?false
on WPVIP because PHP?realpath()
?function does not support PHP stream wrappers. This is because the VIP platform uses the?VIP File System, which is?an object-store that lacks a true directory structure. They implemented?a PHP Stream Wrapper to handle the WordPress integration?with this file system.What we have done to overcome this situation is that we applied a patch:
if ( (realpath( $file ) === false && file_exists( $file ) === false ) || ! is_file( $file ) || ! is_readable( $file ) ) { return false;
Since realpath() validation was added for security, we extended it by using file_exists(). This way, if file_exists() returns
true
even if realpath() returnsfalse
, it would still pass the validation, hence allowing us to keep using Elementor with SVG icons.Please notice that this is an issue on the free version of elementor, that affects sites hosted in platforms that uses custom file systems (such as WPVIP).
I hope this can help to add this fix in a future version of Elementor.
BR/AR
The page I need help with: [log in to see the link]
- The topic ‘SVG images not loading after updating to Elementor 3.19.1’ is closed to new replies.