[wp-trac] [WordPress Trac] #27413: PHP warnings generated by wp_generate_tag_cloud

WordPress Trac noreply at wordpress.org
Fri Mar 14 12:44:53 UTC 2014


#27413: PHP warnings generated by wp_generate_tag_cloud
--------------------------+-----------------------------
 Reporter:  tomdxw        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 PHP Warning: min(): Array must contain at least one element in
 /var/vhost/xxxx/wp-includes/category-template.php on line 658
  PHP Warning: max(): Array must contain at least one element in
 /var/vhost/xxxx/wp-includes/category-template.php on line 659

 I'm not sure how to reproduce the bug but it can be fixed easily by
 replacing min( $counts ) with count( $counts ) > 0 ? min( $counts ) : 0
 and replacing max( $counts ) with (count( $counts ) > 0 ? max( $counts ) :
 0). Or by checking whether $counts is empty and returning early.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27413>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list