Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#27850 closed defect (bug) (fixed)

WP 3.9 - PHP Warnings in Customizer if Theme has set a default image for Custom Header

Reported by: mh-themes's profile MH Themes Owned by: nacin's profile nacin
Milestone: 3.9.1 Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

I just noticed a bug which did not appear in WP 3.8.3. When a theme has defined a default image for custom header support like:

$header = array(
	'default-image'	=> get_template_directory_uri() . '/images/logo.png',
	'default-text-color' => '000',
	'width' => 300,
	'height' => 100,
	'flex-width' => true,
	'flex-height' => true
);
add_theme_support('custom-header', $header);

The customizer outputs PHP warnings when loading:

Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/wordpress/wp-admin/custom-header.php on line 1248
Warning: array_merge(): Argument #2 is not an array in /Applications/MAMP/htdocs/wordpress/wp-admin/custom-header.php on line 1268
Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/wordpress/wp-admin/custom-header.php on line 1248
Warning: array_merge(): Argument #2 is not an array in /Applications/MAMP/htdocs/wordpress/wp-admin/custom-header.php on line 1268

If I comment out:

'default-image'	=> get_template_directory_uri() . '/images/logo.png'

Then everything works fine. Except that there is no default image defined anymore. ;-)

Attachments (1)

27850.diff (569 bytes) - added by obenland 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 @MH Themes
9 years ago

  • Component changed from Themes to Appearance

@obenland
9 years ago

#2 @obenland
9 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.9.1

Introduced in r27849.

Themes can specify a default image without registering it as a default header.
In that scenario $this->default_headers would be null.

#3 @kovshenin
9 years ago

  • Version changed from 3.9 to 3.4

There's also the same warning in reset_header_image(), fixed by the same patch.

#4 @ocean90
9 years ago

#27913 was marked as a duplicate.

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.


9 years ago

#6 @SergeyBiryukov
9 years ago

  • Version changed from 3.4 to 3.9

This appears to be a regression introduced in [27849]. Restoring the correct version number.

#7 @SergeyBiryukov
9 years ago

#27913 was marked as a duplicate.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


9 years ago

This ticket was mentioned in IRC in #wordpress-dev by nacin1. View the logs.


9 years ago

#10 @nacin
9 years ago

  • Owner set to nacin
  • Status changed from new to assigned

Tested by jeremyfelt. Assigning to me for final review, since I wrote this code.

#11 @nacin
9 years ago

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

In 28275:

Custom header: Avoid warnings in the process_default_headers() method.

props obenland.
fixes #27850.

#12 @nacin
9 years ago

In 28277:

Custom header: Avoid warnings in the process_default_headers() method.

Merges [28275] to the 3.9 branch.

props obenland.
fixes #27850.

Note: See TracTickets for help on using tickets.