[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 Aug 9 12:09:19 UTC 2022


#29660: Functions in wp_includes/query.php assume non-null return value from
get_queried_object
-------------------------------------------------+-------------------------
 Reporter:  yellyc                               |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.1
Component:  Query                                |     Version:  4.0
 Severity:  normal                               |  Resolution:
 Keywords:  2nd-opinion has-patch has-unit-      |     Focuses:
  tests php8                                     |
-------------------------------------------------+-------------------------

Comment (by deksar):

 I'm getting similar warnings under PHP 8, with any urls of my website,
 ending with /feed/;

 **Attempt to read property “post_type” on null in /wp-includes/class-wp-
 query.php on line 4338**

 (the feed link gets displayed, however the warning is at the top of the
 page - each /feed page)

 I've searched for that warning message on Google and I can say came up
 with almost hundreds of websites indexed with that warning message in the
 results.

 So, it seems that’s a very common problem.

 The warning appears only in **/feed/** pages, the mentioned line in php
 file contains:
 **return in_array( $post_obj->post_type, (array) $post_types, true );**

 **Wordpress version: 6.0.1**
 **PHP version: 8.0.20**

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


More information about the wp-trac mailing list