[wp-trac] [WordPress Trac] #46660: PHP Warning: count()

WordPress Trac noreply at wordpress.org
Tue Mar 26 16:38:01 UTC 2019


#46660: PHP Warning:  count()
--------------------------+----------------------
 Reporter:  betimademi    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by garrett-eclipse):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hi @betimademi

 The get_metadata function returns either a string, array or boolean. If it
 returns either a string or boolean and you call the `count` function it's
 going to error. So do a check in your conditional for `is_array` prior to
 your use of count to avoid this error.

 As well the Core Trac here is for development of the core and not support.
 For further assistance with your issue please consult the appropriate
 channels;
 Support - https://wordpress.org/support/
 Forums - https://wordpress.org/support/forums/

 All the best

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


More information about the wp-trac mailing list