Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#7222 closed defect (bug) (fixed)

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

Reported by: fyre's profile fyre Owned by: jacobsantos's profile jacobsantos
Milestone: 2.6.1 Priority: normal
Severity: normal Version: 2.5.1
Component: General Keywords: widgets has-patch tested commit
Focuses: 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 (1)

7222.r8534.diff (365 bytes) - added by santosj 17 years ago.
Adds type casting to the variable to prevent error. Based off of r8534

Download all attachments as: .zip

Change History (7)

#1 @thee17
17 years ago

  • Milestone set to 2.7

#2 @santosj
17 years ago

  • Owner changed from anonymous to jacobsantos

@santosj
17 years ago

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

#3 @santosj
17 years ago

  • Keywords has-patch tested commit added; array_merge php removed

#4 @ryan
17 years ago

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

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

#5 @ryan
17 years ago

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

#6 @ryan
17 years ago

  • Milestone changed from 2.7 to 2.6.1
Note: See TracTickets for help on using tickets.