Title: Illegal string offset warning
Last modified: August 22, 2016

---

# Illegal string offset warning

 *  [codeGlaze](https://wordpress.org/support/users/codeglaze/)
 * (@codeglaze)
 * [11 years ago](https://wordpress.org/support/topic/illegal-string-offset-warning/)
 *     ```
       PHP Warning:  Illegal string offset 'width' in [..]/wp-content/plugins/responsify-wp/includes/create_responsive_image.php on line 60
       PHP Warning:  Illegal string offset 'height' in [..]/wp-content/plugins/responsify-wp/includes/create_responsive_image.php on line 61
       ```
   
 * Just noticed this today while I was debugging some new code on a site.
    It doesn’t
   look to be affecting functionality at the moment.
 * [https://wordpress.org/plugins/responsify-wp/](https://wordpress.org/plugins/responsify-wp/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/illegal-string-offset-warning/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/illegal-string-offset-warning/page/2/?output_format=md)

 *  Plugin Author [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * (@stefanledin)
 * [11 years ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946490)
 * Hi codeGlaze!
    I think I’ve seen this error in another thread. Do you have a 
   very small image somewhere? It might be that image that is causing the error.
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946761)
 * Yeah, I’ve had those too (we’ve discussed it earlier).
    Thought they were gone,
   but indeed it’s still firing those warnings. Strange thing is it only occurs 
   on our prod server (php-cgi), not on local dev (php-cgi or mod) …
 *  Plugin Author [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * (@stefanledin)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946762)
 * Okey. I really don’t know where to start with this. Which PHP version are you
   guys using? Is the warnings printed on all pages? Is there many errors, one per
   image?
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946765)
 * Hi !
    Well I’ve been in touch with our hosting, and I put this on a side note,
   to see if they can think about something. I tried everything here, several versions
   of PHP (from 5.4 to 5.6), module and CGI (on MAMP) and no errors are thrown (
   console logs or with WP_Debug on). This only occurs on the prod server and I 
   think only one time for each parameter ‘height’ and ‘width’.
 * Sadly, the errors are not precise enough to let me know which images are concerned.
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946793)
 * Hi !
    I got back on these errors and weeks after, there still here.
 * Looking at the logs, It seems the error is just sent 1 time, I mean one time 
   per visit, 1 error for the width and one for the height. But impossible to tell
   which image do this… one sure thing we don’t have small image, as you suggested
   earlier.
 * After checking the plugin code, and the exact lines mentioned (always the same),
   I decided to put an if (isset(…)) around the array declared here. And it seems
   to have stopped the errors, without breaking functionality.
 * In create_responsive_image.php, line 55 :
 *     ```
       if ( isset($image_meta_data['width']) && isset($image_meta_data['height']) ) {
           $image_meta_data['sizes']['full'] = array(
               'width' => $image_meta_data['width'],
               'height' => $image_meta_data['height']
           );
       }
       ```
   
 * I don’t know why, but it seems that the images don’t always have image and width
   referenced for the ‘full’ size.
    So wait and see.
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946794)
 * Sorry, I meant : it seems that the images don’t always have HEIGHT and width 
   referenced for the ‘full’ size. 😉
 *  Plugin Author [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * (@stefanledin)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946795)
 * I see. Well this is interesting behaviour! But if this is the solution for you,
   I’m glad to add it in the next release. RWP 1.9 is a huge update and I’ve been
   working on it many weeks now, so I hope I can release it soon 🙂
    Thanks for 
   investigating 😉
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946825)
 * Hi stefan,
    have you come across those errors now ? They’re still filling pages
   on my logs, and I don’t if it’s affecting the site perfs or not.
 * I don’t really have clues about what happens but it seems though, that there’s
   only one error thrown for each page AND it also seems that the debug don’t print
   comment for the first image using Responsify WP… but as it doesn’t print info
   I can’t tell you more on this…
 *  Plugin Author [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * (@stefanledin)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946827)
 * Nope, I still haven’t seen this myself.
    If there’s no debug comments, RWP hasn’t
   been able to do anything with the image. It usually means that RWP couldn’t find
   the image ID in the database. What theme are you using? Is it anything you can
   send me so I can try it out?
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946828)
 * Hi ! We use our own-coded theme, and unfortunately I can’t send it here…
    But
   you’re pointing me to a good direction, it seems something prevent RWP from getting
   the correct ID… I’ll check functions.php to see if something here could interfere.
 * But still, the image is loaded. So there’s a fallback if RWP fails ? Or might
   the problem be elsewhere ?
 *  Plugin Author [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * (@stefanledin)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946829)
 * If RWP can’t do something with the image, it just leaves it in the way WordPress
   prints it from the beginning.
    RWP takes the image URL and searches for it in
   the database and gets the ID. I’ve seen issues in the past with the location 
   of the uploads folder. Is there any difference between the URLs of the images
   that does work vs the one that doesn’t?
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946830)
 * No, apparently not.
    But we have a special config for FTP, don’t know if there’s
   an impact. We also use Cloudflare, maybe it can be something with the url rewriting
   at some point ?
 * I’ve checked again for the URLs, and I see that some debug info are completely
   missing while RWP have done it’s job and outputted the img tag. Especially inside
   the_content.
 * Also, I’m still using the old fashion call to RWP (Picture::create), do you advise
   me to change it to the “rwp_img();” function ?
 * Thx for your support !
 *  Plugin Author [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * (@stefanledin)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946831)
 * Okey, yeah I definitely suspect that the URL rewriting may have something to 
   do with it. Have you tried if the native implementation of responsive images (
   from WP 4.4) works?
 * No, you’ll be fine using `Picture::create()`. `rwp_img()` is actually calling
   Picture::create under the hood 😉
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946832)
 * No ! I did not. I’ll try that and see what it returns.
 *  [dapickboy](https://wordpress.org/support/users/dapickboy/)
 * (@dapickboy)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/#post-5946833)
 * mmmh…
    I had to deactivate RWP to make it work, but the native implementation
   works. Except that it’s not returning (as RWP do) the ‘http:’ prefix in the URL,
   it begins with the “//”. Can it be some hint for us ?

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/illegal-string-offset-warning/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/illegal-string-offset-warning/page/2/?output_format=md)

The topic ‘Illegal string offset warning’ is closed to new replies.

 * ![](https://ps.w.org/responsify-wp/assets/icon-256x256.png?rev=1209208)
 * [Responsify WP](https://wordpress.org/plugins/responsify-wp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/responsify-wp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/responsify-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/responsify-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/responsify-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/responsify-wp/reviews/)

## Tags

 * [PHP Warning](https://wordpress.org/support/topic-tag/php-warning/)

 * 16 replies
 * 3 participants
 * Last reply from: [stefanledin](https://wordpress.org/support/users/stefanledin/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/illegal-string-offset-warning/page/2/#post-5946834)
 * Status: not resolved