Opened 7 years ago
Closed 7 years ago
#35935 closed defect (bug) (fixed)
Correctly return zero terms when offset is greater than term count
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch has-unit-tests needs-testing |
Focuses: | Cc: |
Description
Reported in https://github.com/WP-API/WP-API/issues/2309
Attachments (2)
Change History (7)
Note: See
TracTickets for help on using
tickets.
Thanks for the ticket and the patch. I've confirmed the issue.
Your fix doesn't go far enough. Your tests are using very large numbers for 'offset' and 'number', which is masking another bug:
get_terms()
is not properly trimming the array when(number + offset) > count( $terms ) > number
. The fix appears to be to skip thecount( $terms ) > $number
check, and run all results that make it this far througharray_slice()
. See 35935.diff. Could you double-check my logic?This collection of bugs exists since [10416], when the fix for hierarchical limits in
get_terms()
was introduced.