WordPress.org

Make WordPress Core

Changeset 43619


Ignore:
Timestamp:
09/03/2018 09:20:58 PM (10 months ago)
Author:
SergeyBiryukov
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 4.9 branch.
Fixes #44809.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

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

    r43617 r43619  
    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.