[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 24 17:41:26 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:  jorbin
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  4.9.3
Component:  Query         |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------

Comment (by jorbin):

 Replying to [comment:16 SergeyBiryukov]:
 > [42581] doesn't look complete to me. Per comment:7, an empty string or
 `false` should be treated the same as `null`.

 That's not how `count` works. It would be a breaking change to set it as 0
 in those instances.

 From http://php.net/manual/en/function.count.php#refsect1-function.count-
 returnvalues

 > Returns the number of elements in array_or_countable. When the parameter
 is neither an array nor an object with implemented Countable interface, 1
 will be returned. There is one exception, if array_or_countable is NULL, 0
 will be returned.

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


More information about the wp-trac mailing list