Title: PHP Warning: Illegal string offset
Last modified: June 1, 2017

---

# PHP Warning: Illegal string offset

 *  [ralfralfralf](https://wordpress.org/support/users/ralfralfralf/)
 * (@ralfralfralf)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/)
 * I get these:
 * Warning: Illegal string offset ‘description’ in /path/to/my/worpress/wp-content/
   plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 310
 * any idea?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [nullmem](https://wordpress.org/support/users/nullmem/)
 * (@nullmem)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/#post-9260449)
 * This is caused by trying to access string as if were an array. Newer versions
   of PHP will give warnings when you do this because it’s not best coding practice
   from a security standpoint. Unfortunately, this is going to require a rewrite
   and I am not sure if the developer wants to mess with it. Sadly this is the only
   plugin that correctly lazy loads youtube videos so there isn’t any other options.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/#post-9260736)
 * sorry guys, had not seen the original post. I’ll look into this one of these 
   days (or weeks) 🙂
 *  [tristanmason](https://wordpress.org/support/users/tristanmason/)
 * (@tristanmason)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/#post-9406462)
 * I’m getting the same error on a client’s site running PHP 7.
 * As a side note, I love both Youtube Lyte and Autoptimize. Thanks for your great
   plugins, Frank!
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/#post-9407055)
 * hmmm, lyte is in desperate need of some tlc 😉
 * OK, can you on (or around) line 502 change
 *     ```
               }
       	return $_thisLyte;
       }
       ```
   
 * in
 *     ```
               }
               foreach (array("title","thumbUrl","HQthumbUrl","dateField","duration","description","captions_data","captions_timestamp") as $key) {
                       if (!array_key_exists($_thisLyte[$key])) {
                               $_thisLyte[$key]="";
                       }
               }
       	return $_thisLyte;
       }
       ```
   
 * so adding the foreach-block?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/#post-9408486)
 * so
 * `if (!array_key_exists($_thisLyte[$key])) {`
 * should actually be
 * `if (!array_key_exists($key,$_thisLyte)) {`
 * sorry about that 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

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

 * ![](https://ps.w.org/wp-youtube-lyte/assets/icon-128x128.png?rev=1836005)
 * [WP YouTube Lyte](https://wordpress.org/plugins/wp-youtube-lyte/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-youtube-lyte/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-youtube-lyte/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-youtube-lyte/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-youtube-lyte/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-youtube-lyte/reviews/)

 * 5 replies
 * 5 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/php-warning-illegal-string-offset-4/#post-9408486)
 * Status: not resolved