The PHP error that just won’t go away

Posted on March 22, 2009 at 1:04 pm (UK)
in: Plugins, Troubleshooting, WordPress

wppluginpagerror-sm

[Update March 25: This problem is now resolved, thanks to collaborative thinking by a group of people shared over Twitter. See update at end of post.]

This is a peculiar error in the ‘Manage Plugins’ WordPress admin page over on my primary blog – three lines containing the same PHP error message:

Warning: Illegal offset type in /mnt/local/home/ehobsonc/www.nevillehobson.com/wp-admin/includes/plugin.php on line 456

It appeared after I’d auto-updated the Chat Catcher plugin to a new version 2.63 as notified by Wordpress’ plugin auto-update feature.

The plugin didn’t succeed in upgrading, only producing the error and not working at all. I removed the plugin files completely via FTP into the server and manual deletion, and uploaded a previous version just so I’d still have the Chat Catcher functionality.

That worked but the error you see above still remains (although it doesn’t seem to be affecting anything on the blog).

Plugin author Shannon Whitley subsequently released a fix, version 2.64, which installed just fine. Again, though, the error text remains on the ‘Manage Plugins’ admin page.

I can’t get rid of it! Shannon suggested one possible solution – de-activating Akismet and then re-activating it – but that didn’t work.

Doing a search on the precise error text turns up a few results, leading with my tweets to Shannon about it!

The only other option it seems, as suggested by Shannon, is de-activating all plugins and then re-activating them. Really reluctant to have to do that unless it absolutely is the only way to fix this.

Surely there’s a simpler way?

[Update March 25:] As you can see from the comments to this post, a number of people have offered some ideas on solutions. And there is a solution that works.

Read on for the details…

I’m especially grateful to Peter Westwood for jumping in following a tweet by Benjamin Ellis, and taking time to write a plugin that when installed and activated, generated loads of text that means something to Peter. :)

So that got the train on the track to seeing what might be behind the PHP error texts.

An email from Peter early this morning proposed a solution, but it was Shannon Whitley’s code suggestion overnight that did the trick (I was in the midst of implementing that when Peter’s email arrived).

What Shannon proposed – which worked – was to add some PHP code to the ‘Hello Dolly’ plugin which, when the plugin was activated and the PHP code executed, would fix a corrupted Active Plugin array in the WordPress database that resulted from activating version 2.63 of Shannon’s Chat Catcher plugin.

So no de-activating/re-activating all plugins, just edit one plugin file and activate it.

Highlighted in yellow, this is Shannon’s code I added to hello.php and the precise place where I inserted it:

hellodollyfix

I activated the plugin and, voila! Error messages gone and back to normal.

wppluginpagnoerror-sm

What I’d be interested in next is understanding exactly what happened here – what caused the error texts in the first place.

Above all, though, thanks to everyone for your help. And perseverance.

{ 13 comments… read them below or add one }

1 Benjamin March 22, 2009 at 1:13 pm

Make a back up of the plugins.php file, then try restoring that file from clean WordPress source?

Reply

2 neville March 22, 2009 at 1:33 pm

Thanks for that suggesgtion, Benjamin. The plugin.php file on the server and the one in the original WordPress 2.7.1 installation are identical (in terms of file size and file date at least).

But I just tried it – copied plugin.php from the server to a local drive, deleted the file on the server, uploaded a fresh plugin.php from the Wordpress installation zip on my local PC to the server.

Headed over to the Manage Plugins admin page… and those three lines of error message are still there. Emptied browser cache, hard refresh. Still there…

Reply

3 Tony Molloy March 22, 2009 at 1:38 pm

Bit of a kludge, but as it’s a Warning: you could just change the value of error_reporting in php.ini so that it doesn’t get displayed – http://uk2.php.net/error_reporting shows all the settings

My knowledge of PHP is pretty basic, but that message suggests you are using an unallowed value as a key, i.e. an array value that doesn’t exist or something that isn’t allowed to be used as a key. e.g, if you had an array that has (A,B,C) in it then echo array(D) would generate that warning.

Hopefully somebody with far more knowledge than me will be along shortly :-)

Reply

4 neville March 22, 2009 at 1:55 pm

Thanks Tony. I’m ultra reluctant to mess with php.ini. I think I’d rather do Shannon’s other suggestion of de-activating/re-activating all plugins if I have to!

Reply

5 Peter Westwood March 22, 2009 at 10:20 pm

It looks like the content of your active_plugins option maybe corrupt.

The code that is generating the warning is the code which goes through the list of active plugins and checks that they are still there and working.

If it finds a non-working plugin in the active list it then records and error and de-activates the plugin giving you a message at the top of the plugins page.

The easiest way to fix this is probably the following:

On the Plugins admin page if you have any recently active plugins then click on the clear list button to clear that list. Then select all your active plugins using the select all check box at the top left of the list and then select de-activate in the bulk actions dropdown and click apply. This will de-activate all the plugins and move them to the recently active list. You can then do the reverse action from the recently active list. Select all again and then choose activate from the bulk actions and click apply.

Hopefully this should clear that warning up.

Reply

6 Robert DeBord March 23, 2009 at 3:53 pm

Did you find a fix for this? I’ve tried to deactivate all plugins and reactivate all except chat catcher, which I’ve since deleted, but I’m still getting the exact same error message you are. If you found a fix I’d love to hear it!

Reply

7 neville March 23, 2009 at 11:44 pm

Thanks for that suggestion, Peter.

I just tried it – de-activated every plugin, re-activated all that subsequently appeared in the last of recent plugins.

Robert, to answer your question – no, it didn’t work. Nothing happened other than Akismet asking me to re-enter my API key again.

So I still have a ‘Manage Plugins’ admin page with the three PHP error message texts at the top of the page as the screenshot above indicates.

I think it’s time to post a help request in the WP forum…

Reply

8 Robert DeBord March 24, 2009 at 3:22 pm

I’ll be checking back on here then. If you find a fix for it can you post it on here or link to it?

Reply

9 Peter Westwood March 24, 2009 at 11:08 pm

Ok. There is definitely some garbage in the option it will be good to see what is in it and then purge it out.

I have written a simple plugin to help you achieve this.

It adds an admin notice on every admin page with the contents of the option printed out so we can see what it contains.

It also adds a special admin page which will empty the list of active plugins thereby deactivating them all. It does this is a nasty way by just updating the option with nothing so make sure you know which ones you had activated before hand!

The plugin code can be seen here: http://playpen.ftwr.co.uk/dropbox/pjw-plugin-debugger.phps and downloaded from here: http://playpen.ftwr.co.uk/dropbox/pjw-plugin-debugger.php.gz

Hope that helps.

Please let us know what you find in the option, it may help stop this happening in the future.

Reply

10 neville March 25, 2009 at 12:03 am

Got it, Peter, thanks. Installed, run and output result emailed to you.

Hope this helps get towards a solution…

Reply

11 Ike March 25, 2009 at 2:50 am

Yep… I’m getting it to. Only one, though, but I’m not shaking it.

Reply

12 neville March 25, 2009 at 9:05 am

The error has gone! Shannon Whitely has a solution. I’ll update this post.

http://www.voiceoftech.com/swhitley/?p=684

Reply

13 Robert DeBord March 27, 2009 at 8:22 pm

Thanks! That fixed it on my end too!

Reply

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post:

Print This Post Print This Post