Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33532 closed defect (bug) (fixed)

WP_Query->parse_tax_query() generates errors for categories and tags as querystring arrays

Reported by: veraxus's profile Veraxus Owned by: boonebgorges's profile boonebgorges
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.4
Component: Query Keywords: has-patch commit
Focuses: Cc:

Description

Categories and Tags get special handling by parse_tax_query() and so while #32454 fixed custom taxonomies, categories and tags will still generate errors when passed as querystring arrays as they are each parsed uniquely.

The included patch applies the #32454 fix to parsing of categories and tags when an array is used in the querystring, and includes 6 new unit tests (3 per taxonomy) for the various related query types.

Attachments (2)

cat-and-tag-querystring-arrays.patch (7.1 KB) - added by Veraxus 9 years ago.
Fixes errors when parsing querystring with arrays for categories or tags, specifically
33532.1.diff (412 bytes) - added by netweb 9 years ago.

Download all attachments as: .zip

Change History (9)

@Veraxus
9 years ago

Fixes errors when parsing querystring with arrays for categories or tags, specifically

#1 @Veraxus
9 years ago

  • Keywords has-patch added

#2 @boonebgorges
9 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to boonebgorges
  • Status changed from new to reviewing

Looks good. Thanks for the patch.

#3 @boonebgorges
9 years ago

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

In 33724:

In WP_Query::parse_tax_query(), allow 'cat' and 'tag' querystrings to be formatted as arrays.

See [33095] #32454 for a previous fix related to custom taxonomies.

Props Veraxus.
Fixes #33532.

@netweb
9 years ago

#4 @netweb
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

33532.1.diff removes an erroneous PHPUnit group # prefix that snuck in via r33724

#5 @netweb
9 years ago

  • Keywords commit added

#6 @boonebgorges
9 years ago

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

In 33850:

Remove # from @ticket annotation in a unit test.

This improper character was erroneously introduced in [33724].

Props netweb.
Fixes #33532.

#7 @boonebgorges
9 years ago

In 35030:

Fix incorrect setup in 'tag' query var test.

The test, introduced in [33724], was intended to demonstrate the behavior of
example.com?tag=foo routing. But an error in the test setup meant that a
URL-encoded tag object was being set as the value of 'tag'. Due to a quirk in
the way that parse_request() parses query vars, an object value for 'tag'
would inadvertently produce correct results in certain cases. But it's not a
usage we actively support, and it's not what was meant to be tested.

See #33532, #34262.

Note: See TracTickets for help on using tickets.