Make WordPress Core

Opened 9 years ago

Closed 9 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 Owned by: westonruter
Priority: normal Milestone: 4.9
Component: Customize Version: 4.7
Severity: normal Keywords: has-patch has-unit-tests commit
Cc: Focuses:

Description

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 9 years ago.
​https://github.com/xwp/wordpress-develop/pull/238

Download all attachments as: .zip

Change History (4)

#1 @westonruter
9 years ago

  • Keywords has-patch has-unit-tests added

#2 @westonruter
9 years ago

  • Keywords commit added
  • Milestone 4.8.1 → 4.9

#3 @westonruter
9 years ago

  • Owner set to westonruter
  • Resolution → fixed
  • Status new → 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.