[wp-trac] [WordPress Trac] #9214: wp_tag_cloud 'RAND' sorting broken if only one tag exist

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 23 07:14:43 GMT 2009


#9214: wp_tag_cloud 'RAND' sorting broken if only one tag exist
--------------------------+-------------------------------------------------
 Reporter:  rognilss      |       Owner:  anonymous     
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  2.8           
Component:  General       |     Version:  2.7.1         
 Severity:  normal        |    Keywords:  tag cloud rand
--------------------------+-------------------------------------------------
 This fault is only triggered if you have a blog where only one post has
 one tag defined. As soon as you add at least one more tag to any post the
 problem goes away.

 The following query in wp_tag_cloud throws several warnings since it will
 cause WordPress to pass invalid arguments between internal functions in
 WordPress. If you use 'ASC' or 'DESC' sorting there is no problem.[[BR]]
 {{{wp_tag_cloud('format=array&orderby=name&order=RAND');}}}

 The following warnings are thrown:[[BR]]
 {{{PHP Warning:  Invalid argument supplied for foreach() in
 ...../wordpress/wp-includes/category-template.php on line 663}}}[[BR]]
 {{{PHP Warning:  array_slice(): The first argument should be an array in
 ...../wordpress/wp-includes/category-template.php on line 670}}}[[BR]]
 {{{PHP Warning:  min(): Array must contain atleast one element in
 ...../wordpress/wp-includes/category-template.php on line 676}}}[[BR]]
 {{{PHP Warning:  max(): Array must contain atleast one element in
 ...../wordpress/wp-includes/category-template.php on line 677}}}[[BR]]
 {{{PHP Warning:  Invalid argument supplied for foreach() in
 ...../wordpress/wp-includes/category-template.php on line 689}}}[[BR]]

 This has been verified on two different WordPress setups where only one
 tag in one post has been defined.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9214>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list