Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#1988 closed defect (bug) (fixed)

plugins admin / Warning: in_array() wrong datatype, line 90

Reported by: tsimmons Owned by:
Milestone: Priority: highest omg bbq
Severity: major Version: 2.0
Component: Administration Keywords: admin plugins array error
Focuses: Cc:


in wp-admin\plugins.php, line 90, throws error when accessing the plugins page of the admin. gettype() on the variable in question ($current_plugins) shows it is a string, sted of array.

In 1.5, the fix was to add a precautionary function to check if active plugins is an array or not:


Attachments (1)

maybe_un.diff (482 bytes) - added by skeltoac 16 years ago.

Download all attachments as: .zip

Change History (6)

#1 @abhay
16 years ago

That seems to be a really bad way to fix the error (and it was a bad way to fix it the first time as well) as it doesn't really _fix_ anything except ignore the error. Doing it again will fix the issue of the warnings but will not fix anything if you try to activate a plugin. You'd need to have another precautionary loop around line 10.

I think the issue is that the 'empty' plugin list was stored initially as a string during the clean install procedures and this is what needs to be fixed. I guessing what we see as the string is the empty array represented as a bytestream.

#2 @abhay
16 years ago

So a simple fix would be to throw in an unserialize() in two lines in ./wp-admin/plugins.php:

line 8 -
current: $current = get_settings('active_plugins');
change to: $current = unserialize( get_settings('active_plugins') );

line 70 -
current: $current_plugins = get_settings('active_plugins');
change to: $current_plugins = unserialize( get_settings('active_plugins') );

Instead of this bad fix, I'd suggest a better fix that correctly unserializes the bytestream before it reaches the variable in ./wp-admin/plugins.php

#3 @skeltoac
16 years ago

Sorry about that, the new function maybe_unserialize() didn't know how to handle an empty array. Now it does with this patch.

16 years ago

#4 @skeltoac
16 years ago

  • Priority changed from normal to highest

#5 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3239]) Unserialize fix. fixes #1988

Note: See TracTickets for help on using tickets.