[wp-trac] [WordPress Trac] #44809: Safeguard `has_errors()` check in extra Customizer validation
WordPress Trac
noreply at wordpress.org
Fri Aug 17 10:43:49 UTC 2018
#44809: Safeguard `has_errors()` check in extra Customizer validation
--------------------------+-----------------------------
Reporter: flixos90 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+-----------------------------
The `customize_validate_{$setting_id}` filter is run in both the
`WP_Customize_Setting` class, but then again in `WP_Customize_Manager`, to
account for cases where someone might have overridden that method without
maintaining the filter.
I ran into an issue earlier causing a fatal error: While the documentation
for `customize_validate_{$setting->id}` states that the parameter is a
`WP_Error`, several plugins and themes have been returning true in case of
success. This is correctly taken care of in `WP_Customize_Setting`, but
not when the filter is executed again in
`WP_Customize_Manager::validate_setting_values()`. `has_errors()` is
called on the filter result, which however (unfortunately) may not always
be a `WP_Error` object. We should add a `is_wp_error()` check to be safe.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44809>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list