Illegal string offset warning
-
I’m getting a few
Illegal string offset
warnings when I open the “GatherContent” page in WordPress. Nothing else is displayed, so I can’t actually do anything with the plugin. I’m getting this error immediately after activating the plugin and clicking on “GatherContent” in the admin menu. I haven’t configured the plugin at all. If I disable warnings or patch the plugin (as explained below), the page loads as it should. These are the full text of the warnings:Warning: Illegal string offset 'fed5f7cb3f57119fe54948b89fd7d345' in /var/www/html/wp-content/plugins/gathercontent-import/includes/classes/views/view.php on line 68 Warning: Illegal string offset 'fed5f7cb3f57119fe54948b89fd7d345' in /var/www/html/wp-content/plugins/gathercontent-import/includes/classes/views/view.php on line 75 < Warning: Illegal string offset 'fed5f7cb3f57119fe54948b89fd7d345' in /var/www/html/wp-content/plugins/gathercontent-import/includes/classes/views/view.php on line 78
The problem is that the
View::views
variable is not being initialized correctly on line 28. It’s being initialized as a string, not as an array. So when it is later accessed as an array, PHP throws a warning. Making this change to line 28 fixes the problem:protected static $views = [];
I’d rather not turn off warnings to fix this, since I’m working in a development environment. So I’ll probably just patch the plugin and hope it gets fixed in the next update. Thanks!
- The topic ‘Illegal string offset warning’ is closed to new replies.