Ticket #7222 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

array_merge() error in wp-includes/widgets.php

Reported by: fyre Assigned to: jacobsantos
Priority: normal Milestone: 2.6.1
Component: General Version: 2.5.1
Severity: normal Keywords: widgets has-patch tested commit
Cc:

Description

Certain installations of WordPress 2.5.1 in a php5 environment experience errors similar to the below: Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /path/to/wp-includes/widgets.php on line 60

This often occurs in installations where the server upgraded from php4.x to php5.x.

This is almost certainly related to a plugin issue, and the first step to resolve should be to ensure all plugins have been upgraded to their latest stable releases (check the author homepage if necessary to ensure). If this does not resolve, the following will:

On the line noted (usually 60), find the code: $sidebar = array_merge($defaults, $args);

The fix is to change the code to: $sidebar = array_merge($defaults, (array)$args);

Attachments

7222.r8534.diff (365 bytes) - added by santosj on 08/04/08 18:40:07.
Adds type casting to the variable to prevent error. Based off of r8534

Change History

07/02/08 10:24:09 changed by thee17

  • milestone set to 2.7.

07/15/08 20:57:50 changed by santosj

  • owner changed from anonymous to jacobsantos.

08/04/08 18:40:07 changed by santosj

  • attachment 7222.r8534.diff added.

Adds type casting to the variable to prevent error. Based off of r8534

08/04/08 18:40:29 changed by santosj

  • keywords changed from array_merge, widgets,php to widgets has-patch tested commit.

08/04/08 20:34:45 changed by ryan

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

(In [8538]) Cast to array to avoid warning. Props santosj. fixes #7222 for trunk

08/04/08 20:35:03 changed by ryan

(In [8539]) Cast to array to avoid warning. Props santosj. fixes #7222 for 2.6

08/04/08 20:35:15 changed by ryan

  • milestone changed from 2.7 to 2.6.1.