[wp-trac] [WordPress Trac] #57491: Php 8.2.0 - error if the Wp Query does not have any post

WordPress Trac noreply at wordpress.org
Fri May 12 19:50:07 UTC 2023


#57491: Php 8.2.0 -  error if the Wp Query does not have any post
--------------------------------+------------------------------
 Reporter:  davidki             |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Query               |     Version:  6.1.1
 Severity:  major               |  Resolution:
 Keywords:  php8 needs-testing  |     Focuses:
--------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-testing => php8 needs-testing


Comment:

 The warning comes from `WP_Query::rewind_posts()`, called as part of
 `::have_posts()`.

 If I'm reading the code correctly, it can be triggered if
 `$this->post_count` is greater than zero but `$this->posts` is empty,
 though it's not quite clear to me how to reproduce this scenario. The
 queries from comment:4 or comment:7 don't seem to trigger it in my
 testing.

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


More information about the wp-trac mailing list