#44809 closed defect (bug) (fixed)
Safeguard `has_errors()` check in extra Customizer validation
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 5.0.3 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Customize | Keywords: | has-patch fixed-major |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (14)
#2
@
6 years ago
- Keywords commit added
- Milestone changed from Awaiting Review to 4.9.9
- Version set to 4.7
Good change. Feel free to commit!
Introduced in #37638.
#3
@
6 years ago
- Owner set to flixos90
- Resolution set to fixed
- Status changed from new to closed
In 43578:
#4
@
6 years ago
- Keywords fixed-major added; commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
This needs to be backported to 4.9.9.
44809.diff fixes the issue.