Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 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 Owned by: nacin
Priority: normal Milestone: 3.9.1
Component: Customize Version: 3.9
Severity: normal Keywords: has-patch
Cc: Focuses:

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 13 years ago.

Download all attachments as: .zip

Change History (13)

#1 @MH Themes
13 years ago

  • Component Themes → Appearance

@obenland
13 years ago

#2 @obenland
13 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review → 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
13 years ago

  • Version 3.9 → 3.4

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

#4 @ocean90
12 years ago

#27913 was marked as a duplicate.

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


12 years ago

#6 @SergeyBiryukov
12 years ago

  • Version 3.4 → 3.9

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

#7 @SergeyBiryukov
12 years ago

#27913 was marked as a duplicate.

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


12 years ago

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


12 years ago

#10 @nacin
12 years ago

  • Owner set to nacin
  • Status new → assigned

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

#11 @nacin
12 years ago

  • Resolution → fixed
  • Status assigned → closed

In 28275:

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

props obenland.
fixes #27850.

#12 @nacin
12 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.