[wp-trac] [WordPress Trac] #43374: PHP 7.2 Warning: count(): Parameter must be an array or an object that implements Countable in /wp-includes/theme.php on line 356

WordPress Trac noreply at wordpress.org
Wed Feb 21 01:35:45 UTC 2018


#43374: PHP 7.2 Warning: count(): Parameter must be an array or an object that
implements Countable in /wp-includes/theme.php on line 356
-----------------------------+------------------------------
 Reporter:  burlingtonbytes  |       Owner:
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Themes           |     Version:  4.9.4
 Severity:  normal           |  Resolution:  duplicate
 Keywords:                   |     Focuses:
-----------------------------+------------------------------
Changes (by jrf):

 * status:  new => closed
 * focuses:  coding-standards =>
 * resolution:   => duplicate


Comment:

 Hi there and thanks for your report!

 Please note that this is already being tracked in #42814.


 > Proposed solution: check if `empty($wp_theme_directories)` before
 performing `count()`.

 As a side-note, your proposed solution is definitely not the correct way
 to go about it as `empty()` will also return `false` on a non-empty
 string, a non-0 integer etc. and all of those would still cause the same
 warning to be thrown in PHP 7.2.

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


More information about the wp-trac mailing list