[wp-trac] [WordPress Trac] #48811: Problem with is_page function when get_queried_object() reurns null

WordPress Trac noreply at wordpress.org
Wed Nov 27 13:09:41 UTC 2019


#48811: Problem with is_page function when get_queried_object() reurns null
--------------------------+-----------------------------
 Reporter:  nwjames       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 My scenario is that I am trying to test a feed. I am trying to do a
 generic feed, ie. of documents where there are none corresponding.

 I get these PHP messages:
 PHP Notice:  Trying to get property 'ID' of non-object in
 /usr/share/wordpress/wp-includes/class-wp-query.php on line 3966
 PHP Notice:  Trying to get property 'post_title' of non-object in
 /usr/share/wordpress/wp-includes/class-wp-query.php on line 3968
 PHP Notice:  Trying to get property 'post_name' of non-object in
 /usr/share/wordpress/wp-includes/class-wp-query.php on line 3970

 When I put additional debug in, I see that $page_obj is set from
 get_queried_object() - which is used without an isset test.

 The path to this is:
 redirect_canonical (wp-includes/canonical.php) line 498 ->
 is_front_page (wp-includes/query.php) 456 ->
 is_front_page (wp-includes/class-wp-query.php) 3879

 Options show_on_front is set to page and page_on_front has a value so
 is_page is called with a value.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48811>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list