[wp-trac] [WordPress Trac] #42860: PHP 7.2 warning - Parameter must be an array or an object that implements Countable in /wp-includes/class-wp-query.php on line 3035

WordPress Trac noreply at wordpress.org
Wed Jan 17 18:21:24 UTC 2018


#42860: PHP 7.2 warning - Parameter must be an array or an object that implements
Countable in /wp-includes/class-wp-query.php on line 3035
-------------------------------+--------------------
 Reporter:  lisota             |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  4.9.3
Component:  Query              |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+--------------------

Comment (by josephscott):

 I agree with doing an array check first, could be something very simple:


 {{{#!php
             $this->found_posts = 0;
             if ( is_array( $this->posts ) ) {
                 $this->found_posts = count( $this->posts );
             }
 }}}

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


More information about the wp-trac mailing list