WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#41007 closed defect (bug) (fixed)

Custom_Image_Header::customize_set_last_used() blocking customizer save response from coming through

Reported by: Collizo4sky Owned by: westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: has-patch
Focuses: administration Cc:

Description

At my company, we are building a plugin that requires resetting the customizer to a blank slate. using the code in this tutorial by @westonruter

When we try to save changes in customizer, we got the error below

[12-Jun-2017 11:06:39 UTC] PHP Fatal error:  Uncaught Error: Call to a member function post_value() on null in /home/vagrant/Code/WordPress/public/wp-admin/custom-header.php:1324
Stack trace:
#0 /home/vagrant/Code/WordPress/public/wp-includes/class-wp-hook.php(298): Custom_Image_Header->customize_set_last_used(Object(WP_Customize_Manager))
#1 /home/vagrant/Code/WordPress/public/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)
#2 /home/vagrant/Code/WordPress/public/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /home/vagrant/Code/WordPress/public/wp-includes/class-wp-customize-manager.php(2739): do_action('customize_save_...', Object(WP_Customize_Manager))
#4 /home/vagrant/Code/WordPress/public/wp-includes/theme.php(2870): WP_Customize_Manager->_publish_changeset_values(4106)
#5 /home/vagrant/Code/WordPress/public/wp-includes/class-wp-hook.php(298): _wp_customize_publish_changeset('publish', 'new', Object(WP_Post))
#6 /home/vagrant/Code/WordPress/public/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Arr in /home/vagrant/Code/WordPress/public/wp-admin/custom-header.php on line 1324

The submitted patch fixes this issue by making sure $wp_customize->get_setting( 'header_image_data' ) return an instance of WP_Customize_Setting

Attachments (1)

custom-header.diff (1.1 KB) - added by Collizo4sky 4 years ago.

Download all attachments as: .zip

Change History (5)

#1 @Collizo4sky
4 years ago

  • Focuses administration added; javascript removed
  • Keywords has-patch added

#2 @westonruter
4 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to westonruter
  • Status changed from new to accepted
  • Version changed from 4.7.5 to 3.9

Good catch.

#3 @Collizo4sky
4 years ago

Happy to help. This is actually my first WordPress contribution. I hope this is the beginning of more contribution to come.

#4 @westonruter
4 years ago

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

In 40935:

Customize: Ensure header_image_data setting exists before attempting to use it.

Amends [27497].
Props Collizo4sky.
Fixes #41007.

Note: See TracTickets for help on using tickets.