[wp-trac] [WordPress Trac] #29660: Functions in wp_includes/query.php assume non-null return value from get_queried_object
WordPress Trac
noreply at wordpress.org
Sat Oct 18 20:16:07 UTC 2014
#29660: Functions in wp_includes/query.php assume non-null return value from
get_queried_object
-------------------------------+------------------------------
Reporter: yellyc | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 4.0
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by boonebgorges):
> As for a valid case in for use of these tags in cases in which the
queried object is empty, I for one make a call to is_category in a
function called at wp_enqueue_scripts, which is called on many occasions,
some of which don't have a queried object.
Do you have any more details about these occasions? To draw out the logic
of SergeyBiryukov's comment a bit more:
https://core.trac.wordpress.org/browser/tags/4.0/src/wp-
includes/query.php#L4326 The logic in `WP_Query::is_page()` would only get
to the `get_queried_object()` check if `$this->is_page` is set (line
4327). It's unclear how this would happen without `get_queried_object()`
having been set - it probably means that some plugin has been messing with
the `$wp_query` global in an unsavory way. If you can share some more info
about the situations where you're seeing the error - such as the other
plugins you're running - we might be able to see more clearly whether we
want to suppress these warnings in core.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29660#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list