WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#41113 closed defect (bug) (fixed)

WP_Term_Query::get_terms() : Do not presume the $taxonomies is a 0-based array

Reported by: david.binda Owned by: boonebgorges
Milestone: 4.9 Priority: normal
Severity: normal Version: 3.7
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

In #23506 the assumption that $taxonomies is a 0-based array has been flagged and patched via r25108, however a part of the fix has been reverted, very likely due to an oversight, in r25162 (addressing unrelated ticket - #11823)

Attached patch is restoring the original fix, which is using reset() instead of assuming that $taxonomies[0] exists.

Attachments (1)

41113.diff (558 bytes) - added by david.binda 3 years ago.

Download all attachments as: .zip

Change History (4)

@david.binda
3 years ago

#1 @swissspidy
3 years ago

  • Component changed from General to Taxonomy
  • Keywords has-patch added
  • Version changed from trunk to 3.7

#2 @boonebgorges
3 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to boonebgorges
  • Status changed from new to assigned

@david.binda Thank you for the patch, and especially for identifying the relevant changesets! This makes our job much, much easier. <3

#3 @boonebgorges
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 40924:

When querying for terms, do not assume that $taxonomies is a 0-indexed array.

In [25108], the logic of term queries was modified to avoid assuming
that the taxonomies array was numerically indexed. See #23506. This
fix was inadvertantly reverted during the refactor in [25162].

Props david.binda.
Fixes #41113.

Note: See TracTickets for help on using tickets.