Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31681 closed defect (bug) (fixed)

Filter `list_terms_exclusions` passes empty array instead of empty string

Reported by: fhwebcs's profile fhwebcs Owned by: boonebgorges's profile boonebgorges
Milestone: 4.2 Priority: normal
Severity: minor Version: 4.2
Component: Taxonomy Keywords:
Focuses: Cc:

Description

In some cases apply_filters( 'list_terms_exclusions', $exclusions, ... ) will pass an empty array via $exclusions instead of an (empty) string as documented.
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/taxonomy.php#L1838

Location: taxononmy.php, line 1836:

$exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies );

Fix should be about 10 lines before (line 1823):

if ( ! empty( $exclusions ) ) {
        $exclusions = ' AND t.term_id NOT IN (' . implode( ',', array_map( 'intval', $exclusions ) ) . ')';
} else { 
        $exclusions = ''; 
}

This is my first bug report, so let me know if I have missed anything ;-).

Change History (2)

#1 @boonebgorges
9 years ago

  • Milestone changed from Awaiting Review to 4.2
  • Severity changed from normal to minor

Thank you for the report!

#2 @boonebgorges
9 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 31813:

Ensure that the $exclusions parameter of 'list_terms_exclusions' filter is always a string.

Props fhwebcs.
Fixes #31681.

Note: See TracTickets for help on using tickets.