Xhuljo
Xhuljo

Reputation: 809

Warning illegal string offset on line 240

I have installed an wp theme and while I open an plugin I got that error illegal string offset on line 240.

This is line 240:

echo '<option value="', $option['value'], '"', $meta == $option['value'] ? ' selected="selected"' : '', '>', $option['name'], '</option>';

Pls Help

Upvotes: 0

Views: 69

Answers (1)

Ekke
Ekke

Reputation: 11

The code snippet expects $option variable to be an array, but for some reason in the code preceding this line, it is probably accidentally set to a string value.

Tip: Look out for variable reuse - same variable being used for different purposes.

Adding a var_dump($option); before this line and checking output is one way to start debugging the issue.

Upvotes: 1

Related Questions