[wp-trac] [WordPress Trac] #35935: Correctly return zero terms when offset is greater than term count
WordPress Trac
noreply at wordpress.org
Wed Feb 24 16:46:12 UTC 2016
#35935: Correctly return zero terms when offset is greater than term count
-------------------------------------------------+-------------------------
Reporter: danielbachhuber | Owner:
Type: defect (bug) | boonebgorges
Priority: normal | Status: reviewing
Component: Taxonomy | Milestone: 4.5
Severity: normal | Version:
Keywords: has-patch has-unit-tests needs- | Resolution:
testing | Focuses:
-------------------------------------------------+-------------------------
Changes (by boonebgorges):
* keywords: has-patch has-unit-tests => has-patch has-unit-tests needs-
testing
Comment:
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 the `count( $terms ) > $number`
check, and run all results that make it this far through `array_slice()`.
See [attachment: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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35935#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list