Skip to content
Permalink
Browse files

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.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43619 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
SergeyBiryukov committed Sep 3, 2018
1 parent 0839d32 commit f8b390c4ff5b44297752befe4cfcdd7130ddded3
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/wp-includes/class-wp-customize-manager.php
@@ -2284,7 +2284,7 @@ public function validate_setting_values( $setting_values, $options = array() ) {
if ( ! is_wp_error( $validity ) ) {
/** This filter is documented in wp-includes/class-wp-customize-setting.php */
$late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting );
if ( ! empty( $late_validity->errors ) ) {
if ( is_wp_error( $late_validity ) && ! empty( $late_validity->errors ) ) {
$validity = $late_validity;
}
}

0 comments on commit f8b390c

Please sign in to comment.
You can’t perform that action at this time.