WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9749 closed defect (bug) (fixed)

Media Upload Library view displaying multiple PHP Warning: array_key_exists() wp-admin/includes/media.php on line 736

Reported by: lusuonline Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Media Keywords: wordpress mu
Focuses: Cc:

Description

Found in Wordpress MU (2.7)
Using Media Upload facility on page or post on any site or blog then selecting Library produces a list of :

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /var/www/html/wp-admin/includes/media.php on line 736

Googled and found multiple solutions which changed the following :

function image_align_input_fields($post, $checked=) {

$alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right');
if ( !array_key_exists($checked, $alignments) )

to put quotes around $checked in the array_key_exist function call like so :

if ( !array_key_exists("$checked", $alignments) )

Attachments (1)

media.php.diff (572 bytes) - added by lusuonline 6 years ago.
Suggested diff from /wp-admin/includes/media.php

Download all attachments as: .zip

Change History (3)

@lusuonline6 years ago

Suggested diff from /wp-admin/includes/media.php

comment:1 @azaozz6 years ago

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

(In [11233]) Cast to string in array_key_exists() in media.php, props lusuonline, fixes #9749

comment:2 @azaozz6 years ago

  • Milestone changed from Unassigned to 2.8

This seems WPMU specific as in WordPress that option is preset. Still good to cast to string just in case.

Note: See TracTickets for help on using tickets.