[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
Wed Jun 22 11:07:36 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                                     |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * keywords:  2nd-opinion has-patch has-unit-tests => 2nd-opinion has-patch
     has-unit-tests php8


Comment:

 Adding the `php8` keyword. As noted in comment:40, the notices were
 promoted to warnings in PHP 8, and the issue is more prominent now.

 I think comment:21 should still be addressed for this to move forward,
 maybe with a `_doing_it_wrong()` message similar to the ones we have when
 calling conditional tags too early:
 {{{
 if ( ! isset( $wp_query ) ) {
         _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not
 work before the query is run. Before then, they always return false.' ),
 '3.1.0' );
         return false;
 }
 }}}

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


More information about the wp-trac mailing list