[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 19:12:49 UTC 2016


#35935: Correctly return zero terms when offset is greater than term count
-------------------------------------------------+-------------------------
 Reporter:  danielbachhuber                      |       Owner:
     Type:  defect (bug)                         |  boonebgorges
 Priority:  normal                               |      Status:  closed
Component:  Taxonomy                             |   Milestone:  4.5
 Severity:  normal                               |     Version:
 Keywords:  has-patch has-unit-tests needs-      |  Resolution:  fixed
  testing                                        |     Focuses:
-------------------------------------------------+-------------------------
Changes (by boonebgorges):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"36691"]:
 {{{
 #!CommitTicketReference repository="" revision="36691"
 Improve 'offset' calculation when querying for hierarchical terms.

 When querying for terms in hierarchical taxonomies, `get_terms()`
 initially
 queries for all matching terms, and then trims the located results based
 on the
 `$number` and `$offset` arguments passed to the function. See #8832.
 However,
 a flaw in the original logic meant that results were failing to be trimmed
 properly in cases where `$offset` exceeds the total number of matching
 terms;
 in these cases, we should force an empty array.

 Props danielbachhuber.
 Fixes #35935.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35935#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list