Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 7 weeks ago

#21515 closed defect (bug) (fixed)

No custom header support in theme == Fatal error: Call to a member function process_default_headers() on a non-object

Reported by: c3mdigital's profile c3mdigital Owned by: ryan's profile ryan
Milestone: 3.4.2 Priority: normal
Severity: normal Version:
Component: Customize Keywords: has-patch commit
Focuses: Cc:

Description

In 3.5 (21468).

Using the customizer on a theme without custom header support causes fatal error.

Fatal error: Call to a member function process_default_headers() on a non-object in /Users/chris/Sites/newpatch/wp-includes/class-wp-customize-control.php on line 759
Call Stack
#	Time	Memory	Function	Location
1	0.0012	287640	{main}( )	../customize.php:0
2	0.3554	19316040	do_action( )	../customize.php:34
3	0.3554	19317640	call_user_func_array ( )	../plugin.php:406
4	0.3555	19317672	WP_Customize_Header_Image_Control->prepare_control( )	../plugin.php:406

var_dump( $custom_image_header ) results in NULL when theme does not have custom header support.

Simple solution that fixes fatal error is a check on the object variable and return if empty.

Attachments (2)

21515.patch (523 bytes) - added by c3mdigital 12 years ago.
21515.2.patch (524 bytes) - added by SergeyBiryukov 12 years ago.
Same as 21515.patch, with proper whitespace

Download all attachments as: .zip

Change History (10)

@c3mdigital
12 years ago

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Appearance
  • Milestone changed from Awaiting Review to 3.5

Introduced in [21383].

@SergeyBiryukov
12 years ago

Same as 21515.patch, with proper whitespace

#2 @ryan
12 years ago

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

In [21497]:

Avoid fatal error in the customizer when the current theme doesn't support custom headers. Props c3mdigital. fixes #21515

#3 @nacin
12 years ago

  • Milestone changed from 3.5 to 3.4.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

#4 @nacin
12 years ago

  • Keywords commit added; dev-feedback removed

Ready to be merged to the 3.4 branch.

#5 @nacin
12 years ago

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

In [21724]:

Remove custom header uploads from the customizer.

For the 3.4 branch. It will return when crop ability is added.

props koopersmith.
see #21355. fixes #21515. fixes #21707.
merges [21379] [21380] [21383] [21385] [21386] [21497] [21722].

#6 @miqrogroove
12 years ago

Seems like a similar problem:

When I activate the 2011 theme and click Customize, it brings up a left-side menu column and a right-side preview of the website.

When I activate an older theme of my own that does not support the new features, it brings up a left-side menu column only, and then continuously auto-refreshes the page until I close it. There are no errors being generated.

Do you need a new ticket for that?

#7 @nacin
12 years ago

Yes please.

#8 @bloomhejm
7 weeks ago

WordPress. The error message you provided indicates that there is an issue with the WP_Customize_Header_Image_Control class and its process_default_headers() method being called on a non-object. This error typically occurs when you attempt to use the Customizer with a theme that doesn't support custom headers.
Here's a possible solution to handle this error by checking whether the WP_Customize_Header_Image_Control object exists before calling its methods:

<?php
if ( class_exists( 'WP_Customize_Header_Image_Control' ) ) {
    $custom_image_header = new WP_Customize_Header_Image_Control( $wp_customize );
    if ( is_object( $custom_image_header ) ) {
        // Process custom header controls here
    }
}

This code snippet checks if the WP_Customize_Header_Image_Control class exists, and if it does, it attempts to create an instance of it. Then, it checks if the instance is a valid object before proceeding to process custom header controls.

Note: See TracTickets for help on using tickets.