[wp-trac] [WordPress Trac] #10393: wp_tag_cloud('order=RAND') broken with PHP >= 5.2.10

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 12 20:31:27 UTC 2009


#10393: wp_tag_cloud('order=RAND') broken with PHP >= 5.2.10
--------------------------+-------------------------------------------------
 Reporter:  Joern_W       |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  2.8.1     
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 From PHP 5.2.10 the result of array_rand is no longer shuffled. So the
 output of wp_tag_cloud('order=RAND') is no longer shuffled.

 possible solution:
 in file category-template.php replace

         elseif ( 'RAND' == $order ) {
                 $keys = (array) array_rand( $tags, count( $tags ) );
                 $temp = array();
                 foreach ( $keys as $key )
                         $temp[$key] = $tags[$key];

                 $tags = $temp;
                 $temp = null;
                 unset( $temp );
         }


 with


         elseif ( 'RAND' == $order ) {
                 shuffle( $tags );
         }

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


More information about the wp-trac mailing list