Ticket #13965 (closed defect (bug): fixed)
wp_get_nocache_headers should always return an array
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | General | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
Apparently sometimes plugins use its filter and don't return an array.
WP should instead cast filtered results to array, so it always returns an array.
Attachments
Change History
comment:1
johnbillion — 2 years ago
It's up to plugins to return a correctly formatted value. Why cast the return value of this one particular filter? Is it any different to the others?
The net number of casts to array is unchanged, just moved to make it more reliable.
In general, I think it's better to try to handle plugins' runtime errors (like this) gracefully, as opposed to say more "compile"-time errors (including the wrong file or using the wrong protocol, etc.).
That's because the latter kind of error is more likely to appear consistently during development and therefore get corrected. But the former might occur only in particular conditions.
- Status changed from accepted to closed
- Resolution set to wontfix
- Milestone Awaiting Triage deleted
- Status changed from closed to reopened
- Resolution wontfix deleted
- Milestone set to 3.1
The wontfix brought me to look at the patch. Looks solid. Definitely a better place for the cast.

