wp_category_checklist may output incorrect results
|Reported by:||hailin||Owned by:||anonymous|
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.