#9670 closed defect (bug) (fixed)
wp_category_checklist may output incorrect results
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (6)
#1
@
16 years ago
This is a safe fix too, as the logic is obvious.
However when the problem occurs, it could be very difficult to track it down.
Note: See
TracTickets for help on using
tickets.
patch