[wp-trac] [WordPress Trac] #55104: is_main_query() fatal error on null

WordPress Trac noreply at wordpress.org
Sat May 14 15:09:15 UTC 2022


#55104: is_main_query() fatal error on null
--------------------------------------+-----------------------------
 Reporter:  nhadsall                  |       Owner:  SergeyBiryukov
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.1
Component:  Query                     |     Version:
 Severity:  major                     |  Resolution:  fixed
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"53395" 53395]:
 {{{
 #!CommitTicketReference repository="" revision="53395"
 Query: Check if `$wp_query` is set in `is_main_query()`.

 This avoids a PHP fatal error and triggers a `_doing_it_wrong()` notice if
 `is_main_query()` is called too early, bringing consistency with all the
 other `is_*()` conditionals: `is_single()`, `is_home()`, etc.

 Follow-up to [16947], [17068], [17083], [18699], [37985].

 Props vdankbaar, nhadsall, johnbillion, costdev, thijsoo, teunvgisteren,
 timkersten655, SergeyBiryukov.
 Fixes #55104.
 }}}

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


More information about the wp-trac mailing list