Title: PHP Warning: Illegal string offset &#8216;height&#8217; / &#8216;width&#8217;
Last modified: December 21, 2018

---

# PHP Warning: Illegal string offset ‘height’ / ‘width’

 *  Resolved [shamank](https://wordpress.org/support/users/shamank/)
 * (@shamank)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/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 989
       ```
   
 * I 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 
   returns `false` when 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)

 *  Plugin Author [Benbodhi](https://wordpress.org/support/users/benbodhi/)
 * (@benbodhi)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-height-width/#post-11018358)
 * Hey there,
 * Yeah this PHP warning is usually fired by the image widget. I have a few things
   like this to work into the plugin. It’s just been absolutely crazy for a while
   and I haven’t had the time I’d like to put in.
 * Hopefully I can dedicate some solid time soon to get this addressed, along with
   a few other things and some better integration with the new block editor.

Viewing 1 replies (of 1 total)

The topic ‘PHP Warning: Illegal string offset ‘height’ / ‘width’’ is closed to new
replies.

 * ![](https://ps.w.org/svg-support/assets/icon.svg?rev=3554681)
 * [SVG Support](https://wordpress.org/plugins/svg-support/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/svg-support/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/svg-support/)
 * [Active Topics](https://wordpress.org/support/plugin/svg-support/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/svg-support/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/svg-support/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Benbodhi](https://wordpress.org/support/users/benbodhi/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-height-width/#post-11018358)
 * Status: resolved