Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#41252 closed defect (bug) (fixed)

Customize: WP_Customize_Manager::save_changeset_post() can fail if get_changeset_post_data method returns WP_Error

Reported by: westonruter's profile westonruter Owned by: westonruter's profile westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch has-unit-tests commit
Focuses: Cc:


If a changeset post is corrupted, then \WP_Customize_Manager::get_changeset_post_data() will return a WP_Error. This method is used by \WP_Customize_Manager::save_changeset_post() to obtain an existing changeset's post data to merge on top of. However, it is not doing the necessary check to see if it is returning a WP_Error, and thus results in a fatal error:

PHP Fatal error: Cannot use object of type WP_Error as array in wp-includes/class-wp-customize-manager.php on line 2334

Will amend [38810] for #30937.

Attachments (1)

41252.0.diff (2.1 KB) - added by westonruter 6 years ago.

Download all attachments as: .zip

Change History (4)

#1 @westonruter
6 years ago

  • Keywords has-patch has-unit-tests added

#2 @westonruter
6 years ago

  • Keywords commit added
  • Milestone changed from 4.8.1 to 4.9

#3 @westonruter
6 years ago

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

In 41012:

Customize: Prevent edge case fatal error when attempting to save changes to a changeset that had previously been corrupted.

Check return value of WP_Customize_Manager::get_changeset_post_data() and return if error instead of assuming it is an array.

Amends [38810].
See #30937.
Fixes #41252.

Note: See TracTickets for help on using tickets.