#44809 closed defect (bug) (fixed)
Safeguard `has_errors()` check in extra Customizer validation
| Reported by: | flixos90 | Owned by: | flixos90 |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.0.3 |
| Component: | Customize | Version: | 4.7 |
| Severity: | normal | Keywords: | has-patch fixed-major |
| Cc: | Focuses: |
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
@
8 years ago
- Keywords commit added
- Milestone Awaiting Review → 4.9.9
- Version → 4.7
Good change. Feel free to commit!
Introduced in #37638.
#4
@
8 years ago
- Keywords fixed-major added; commit removed
- Resolution fixed
- Status closed → reopened
This needs to be backported to 4.9.9.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
44809.diff fixes the issue.