query.php: get_queried_object() result cannot be assumed to be non-NULL
|Reported by:||lkraav||Owned by:||wonderboymusic|
Description (last modified by SergeyBiryukov)
I'm dealing with a WPMUdev plugin called MarketPress. Its /store/products/ page is a special CPT catalog thing that seems to have wp_title() issues, so I dug into it.
Turns out that:
is_front_page() -> is_page() -> $page_obj = $this->get_queried_object() -> $page_obj == NULL
But is_page() (and other is_...()) go harrassing $page_obj assuming there's always something useful there. This creates a flood of "non-object access" notices.
I would expect something like this to make sense in these is_...() functions:
if (!is_null($page_obj)) return false;
Since WP_Query::get_queried_object() first sets its result as null and returning a value is actually conditional, I don't see a way around these checks. Enlighten me please if I'm wrong.
Change History (19)
comment:3 wonderboymusic — 18 months ago
- Component changed from Query to Warnings/Notices
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.5
- Owner set to wonderboymusic
- Status changed from new to accepted
comment:8 markoheijnen — 16 months ago
- Keywords early removed
- Milestone changed from Future Release to 3.6
comment:14 wonderboymusic — 7 months ago
- Resolution set to fixed
- Status changed from accepted to closed