[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
Tue Apr 14 15:21:38 UTC 2015


#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):

 darkskipper - Thanks very much for the detailed steps to reproduce. I've
 managed to verify. In your specific case, the problem arises from a
 combination of a non-existing feed request + the use of the "front page"
 setting in Dashboard > Settings > Reading. This leads to a number of
 places in `redirect_canonical()` where `is_front_page()` is invoked, which
 in turn calls `is_page( get_option( 'page_on_front' ) )`. It's this last
 bit that's causing the PHP notice. The correct fix here is not a band-aid
 over the notice, but to ensure that we never get this far in the
 `is_front_page()` chain when we're looking at a feed. I recommend
 something like [attachment:29660.diff] - `is_front_page()` ought never to
 return `true` for feeds.

 So, two questions. (1) Does anyone see a problem with this? Are there
 cases where `is_front_page()` might be true when `is_feed`? (2) yellyc -
 is your case similar to this one?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29660#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list