Ticket #6532 (reopened defect)

Opened 8 months ago

Last modified 6 months ago

db collation and db charset break serialize and unserialize on some sites

Reported by: tandilboy Assigned to: anonymous
Priority: normal Milestone: 2.9
Component: General Version: 2.5
Severity: normal Keywords:
Cc:

Description

shows this error Warning: array_keys() [function.array-keys]: The first argument should be an array in /www/lu22radiotandil.com.ar/htdocs/wp-includes/widgets.php on line 654

Warning: Invalid argument supplied for foreach() in /www/lu22radiotandil.com.ar/htdocs/wp-includes/widgets.php on line 654

i Using PHP 5 + MySQL 5.0

my blog http://www.lu22radiotandil.com.ar (fix the error please). send the fix

Attachments

6532.patch (0.6 kB) - added by DD32 on 04/01/08 22:34:52.

Change History

04/01/08 22:34:52 changed by DD32

  • attachment 6532.patch added.

04/01/08 22:35:45 changed by DD32

attachment 6532.patch added.

Should fix it. I couldnt reproduce the error though, The only way i can see it could happen is if widget_text contained a non-array value, which shouldnt actually happen AFAIK?

04/02/08 21:00:56 changed by tandilboy

i apply the fix but the error dont fix

Warning: array_keys() [function.array-keys]: The first argument should be an array in /www/lu22radiotandil.com.ar/htdocs/wp-includes/widgets.php on line 654

Warning: Invalid argument supplied for foreach() in /www/lu22radiotandil.com.ar/htdocs/wp-includes/widgets.php on line 654

check at http://www.lu22radiotandil.com.ar

PLEASE FIX :(

04/03/08 11:28:12 changed by hakre

DD32, it's nice to see you try to patch something but on the otherhand please only patch something if you analyzed the actual bug and found its cause. Otherwise this can result in one or many steps backwards.

tandilboy, please setup a brandnew 2.5 installation from scratch and report if this error still occurs. then copy over, one by one, the plugins that do have your widgets and test them one after another when the error occurs.

Since widgets API changed (as far as I can see), it might be the case that one or more of your widgets does not work with 2.5.

04/03/08 14:34:32 changed by tandilboy

NOTE: the error shows in all Admin pages too.

No solution deactivating all plugins and reinstalling wordpress

04/05/08 14:11:31 changed by Denis-de-Bernardy

Just a guess... in your theme, insert this code somewhere to see the output:

var_dump(get_option('widget_text'));

if this outputs a weird looking string with braces and semicolons all over, instead of a nice array, this means your option's value is corrupt.

assuming so... I've seen this happen a bunch of time on my own customers' blogs, not to mention my own.

open phpmyadmin, and run:

delete from wp_options where option_name = 'widget_text';

this will delete the text widgets and let you recreate them as appropriate.

while fixing customer sites, I've found that the true underlying issue was that, for some reason, WP's db charset and db collation settings that do not play well with serialize and unserialize.

this brings me to the second fix in the event it reoccurs later on. edit the wp-config.php file, and to remove the two defines for db charsets and db collation. then, delete the widget text option again, and you should be fine in the future.

anyway, if the above tip fixes your site, change this ticket's title to:

db collation and db charset break serialize and unserialize on some sites

also provide sample text and the original db collation and charset settings, and the contents of your phpinfo so the devs can try to reproduce. it would be nice if it no longer occurred. :)

D.

04/07/08 12:39:53 changed by tandilboy

  • status changed from new to closed.
  • resolution set to fixed.

Denis-de-Bernardy

the fix works well :D

i deleted the widget_text from wp_options. and the error fixed :)

thank u :)

04/07/08 16:15:33 changed by Nazgul

  • status changed from closed to reopened.
  • severity changed from major to normal.
  • summary changed from Warning: The first argument should be an array in /www/lu22radiotandil.com.ar/htdocs/wp-includes/widgets.php on line 654 to db collation and db charset break serialize and unserialize on some sites.
  • priority changed from high to normal.
  • milestone changed from 2.5.1 to 2.6.
  • resolution deleted.

04/28/08 14:29:01 changed by Denis-de-Bernardy

04/28/08 14:32:07 changed by Denis-de-Bernardy

05/16/08 09:08:56 changed by hakre

Nazgul are you shure this is charset related? If then, isn't it a configuration issue?