WordPress.org

Make WordPress Core

Changeset 44392


Ignore:
Timestamp:
01/04/2019 08:29:41 PM (7 months ago)
Author:
desrosj
Message:

Customize: Safeguard a check on the customize_validate_{$setting_id} filter value to ensure it is a WP_Error.

While the filter is documented to only support a WP_Error, it has been a common practice to return true in a validation function if no errors have occurred. This was already caught when the same filter was executed in WP_Customize_Setting, it was however missing in WP_Customize_Manager::validate_setting_values().

Props flixos90.

Merges [43578] to the 5.0 branch.
Fixes #44809.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/src/wp-includes/class-wp-customize-manager.php

    r43887 r44392  
    22852285                /** This filter is documented in wp-includes/class-wp-customize-setting.php */
    22862286                $late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting );
    2287                 if ( ! empty( $late_validity->errors ) ) {
     2287                if ( is_wp_error( $late_validity ) && ! empty( $late_validity->errors ) ) {
    22882288                    $validity = $late_validity;
    22892289                }
Note: See TracChangeset for help on using the changeset viewer.