[wp-trac] [WordPress Trac] #9670: wp_category_checklist may output incorrect results

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 28 18:46:47 GMT 2009


#9670: wp_category_checklist may output incorrect results
--------------------------+-------------------------------------------------
 Reporter:  hailin        |       Owner:  anonymous 
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:            
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 wp_category_checklist has a loop through $categories, it assumes the index
 begins with 0, and auto-increments.  Most $categories will be that case.
 However, this is a shaky assumption. PHP doesn't guarantee that.  I've
 seem its index begin with 2, for example. and it may not be consecutive.

 This will cause the function to output wrong data set sometimes.
 The idea is similar to #9661

 The fix is to get array_keys first, then loop through the keys. I've
 verified that the following patch works correctly.

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


More information about the wp-trac mailing list