Opened 13 years ago
Last modified 7 years ago
#24548 new defect (bug)
_wp_menu_item_classes_by_context assumes $queried_object->ancestors is an array
| Reported by: | wpsmith | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: | Focuses: |
Description
Recently, on a site using CPT-onomies, I ran into an interesting error with _wp_menu_item_classes_by_context().
In this function, when setting the parent class, there is a large if statement that assumes that $queried_object->ancestors and $possible_taxonomy_ancestors[ $parent_item->object ] are arrays.
Attachments (1)
Change History (5)
#2
follow-up:
↓ 3
@
12 years ago
- Keywords reporter-feedback added; dev-feedback removed
- Milestone 3.9 → Awaiting Review
When are either of these not arrays?
For the first one, post objects always return get_post_ancestors(), which always returns an array. (It briefly did not: #22882.)
For the second one, that array must be set (the line above it) before it is treated as an array. It is set to be an array within the function.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This function...