WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7222 closed defect (bug) (fixed)

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

Reported by: fyre Owned by: 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 6 years ago.
Adds type casting to the variable to prevent error. Based off of r8534

Download all attachments as: .zip

Change History (7)

comment:1 thee176 years ago

  • Milestone set to 2.7

comment:2 santosj6 years ago

  • Owner changed from anonymous to jacobsantos

santosj6 years ago

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

comment:3 santosj6 years ago

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

comment:4 ryan6 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

comment:5 ryan6 years ago

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

comment:6 ryan6 years ago

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