Ticket #7222 (closed defect (bug): fixed)

Opened 4 years ago

Last modified 4 years ago

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

Reported by: fyre Owned by: 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 Download (365 bytes) - added by santosj 4 years ago.
Adds type casting to the variable to prevent error. Based off of r8534

Change History

  • Milestone set to 2.7
  • Owner changed from anonymous to jacobsantos

santosj4 years ago

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

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

comment:4   ryan4 years ago

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

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

comment:5   ryan4 years ago

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

comment:6   ryan4 years ago

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