PHP Warning: Illegal string offset ‘height’ / ‘width’
-
Hi! I’m using PHP 7.1, WP 5.0.2 and Avada theme. I realized that in some cases (I’m not which ones), the error log is showing me errors with the size of some svg images:
PHP Warning: Illegal string offset 'width' in /blablabla/wp-includes/media.php on line 988 PHP Warning: Illegal string offset 'height' in /blablabla/wp-includes/media.php on line 989I fixed it with a custom function in my child theme (a filter to modify the returned value in
wp-includes/post.php => wp_get_attachment_metadata()) that simply returnsfalsewhen some of these properties are not present:14 function wp_get_attachment_metadata_mine($data) { 15 16 $res = $data; 17 if (!isset($data['width']) || !isset($data['height'])) { 18 $res = false; 19 } 20 21 return $res; 22 } 23 add_filter( 'wp_get_attachment_metadata' , 'wp_get_attachment_metadata_mine' );I saw this error in some other sites (of mine), so I was wondering if you could “fix” this in some way in your plugin. I’m not a WP dev so I’m not sure it’s possible.
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘PHP Warning: Illegal string offset ‘height’ / ‘width’’ is closed to new replies.