-3

We are getting this error after upgrading our web server's PHP to version 5.6. The error is being displayed on the home page of one of our Wordpress website with a Woo Themes Theme.

Screenshot of the error:

Image

Here is the line 736 in the theme-actions.php file

if ( !$layout['woo_layout'] )
Keith OYS
  • 2,285
  • 5
  • 32
  • 38
BMA Media
  • 1
  • 2
  • 3
    Welcome to Stack Overflow! You can read up on how to [ask] a question and create a [mcve]. That makes it easier for us to help you. – Katie Dec 01 '16 at 17:02
  • Can we get an auto-dupe algorithm going for any questions that contain "illegal string offset"? – MonkeyZeus Dec 01 '16 at 17:03
  • `woo_layout` is not defined. Work backwards from that line and find out why. – MonkeyZeus Dec 01 '16 at 17:04
  • `$layout` is probably a string, not an array. – aynber Dec 01 '16 at 17:06
  • 1
    Possible duplicate of [Illegal string offset Warning PHP](http://stackoverflow.com/questions/9869150/illegal-string-offset-warning-php) – aynber Dec 01 '16 at 17:07
  • Other possible duplicate: http://stackoverflow.com/questions/15361392/how-do-i-correct-this-illegal-string-offset – aynber Dec 01 '16 at 17:08

1 Answers1

1

That warning is telling you:

"Hey, the variable $layout is not an array."

The conditional expression you've shown wants it to be an array. It's checking if the element (keyed by 'woo_layout') has a non-falsey value in it. But when that line of code runs for your home page, the variable is set to a string value and not an array.

How to Verify

Well, you want to dump the value out to the browser (or use XDebug) to check what it's set to when that line of code runs. Therefore, put this code in right away the if ():

var_dump( $layout['woo_layout'] );

Once you see the value, then you can backtrace to find what is going on.

My guess (pure guess since I haven't seen the Woo Theme code) is: you need to set a layout option for that page. It's likely a metadata (custom field) option you need to set. But you can reach out to Woo and ask them for help.

hellofromTonya
  • 1,301
  • 8
  • 8
  • We were able to remove the error by commenting out the offending line and the line below it. `/* if ( !$layout['woo_layout'] ) */ ` `/* $layout = get_option( 'woo_layout' ); */` – BMA Media Dec 02 '16 at 16:05