[wp-trac] [WordPress Trac] #41446: The PHP notice displayed after the overwriting global $posts by a new empty query.

WordPress Trac noreply at wordpress.org
Wed Jul 26 11:15:00 UTC 2017


#41446: The PHP notice displayed after the overwriting global $posts by a new empty
query.
-----------------------------+------------------------------
 Reporter:  danielpietrasik  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Query            |     Version:  4.8
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by umangvaghela123):

 It is fine If we can check !empty condition.

 <?php public function rewind_posts() {
         $this->current_post = -1;
         if ( isset( $this->posts[0] ) && !empty( $this->post_count ) &&
 $this->post_count > 0 &&  ) {
                 $this->post = $this->posts[0];
         }
 }

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


More information about the wp-trac mailing list