WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17054 closed defect (bug) (fixed)

Multiple tag queries broken

Reported by: neoxx Owned by:
Milestone: 3.1.2 Priority: normal
Severity: normal Version: 3.1.1
Component: Taxonomy Keywords: has-patch commit
Focuses: Cc:

Description

Hi,

Since the update to 3.1.1 archive pages like /tag/tag1+tag2/ result in a 404. Could anybody verify this?

Tested with 3.1.1 and latest trunk w/ TwentyTen

Cheers,
Berny

Attachments (3)

17054.diff (536 bytes) - added by ryan 5 years ago.
17054.2.diff (540 bytes) - added by scribu 5 years ago.
Leave only 'NOT IN' check
unit-query-flags.php (7.5 KB) - added by scribu 5 years ago.
query flag unit tests

Download all attachments as: .zip

Change History (20)

#1 @scribu
5 years ago

  • Keywords reporter-feedback added

We can't reproduce it. Have you tried deactivating all plugins?

#2 @ryan
5 years ago

Due to #16730, 3.1 would sometimes do an OR when it should have been doing an AND for these requests. tag1+tag2 is an intersection and tag1,tag2 is a union. Is an intersection (AND) what you are expecting from tag1+tag2?

#3 @ryan
5 years ago

3.1.1 doesn't set a queried object for tag1+tag2. 3.0 sets the queried object to tag1.

#4 @ryan
5 years ago

  • Milestone changed from Awaiting Review to 3.1.2
  • Version set to 3.1.1

#5 @scribu
5 years ago

3.1.1 doesn't set a queried object for tag1+tag2. 3.0 sets the queried object to tag1.

To clarify, 3.1 also did this.

@ryan
5 years ago

#6 @ryan
5 years ago

The is_* flags are not being set for AND queries. Patch fixes that.

#7 @neoxx
5 years ago

Sorry, it took me a little bit as I was *unknowingly* using a child theme of TwentyTen which pretty much looked the same, except the index.php has been modified. And as far as I can tell, that's where my 404 came from:

Queries to /tag/tag1/ would be handled by the tag.php template while /tag/tag1+tag2/ (logical AND) would be redirected to index.php.

Anyway, Ryan's patch looks good to me on my machine. - Gonna test it on another system.

#8 @neoxx
5 years ago

  • Keywords close added; reporter-feedback removed

yep, works as well.

thanks for the quick fix!

#9 @nacin
5 years ago

  • Keywords close removed

The close keyword is for recommending the resolution of a ticket, other than fixed (wontfix, invalid, etc.).

#10 @neoxx
5 years ago

sorry. - still trying to keep with the latest changes to the trac workflows...

#11 @ryan
5 years ago

NOT requests seem unaffected. Neither 3.0 nor 3.1.1 set queried object or is_* flag for pure NOT/NOT IN requests.

#12 @ryan
5 years ago

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

(In [17606]) Set is_* flags for AND taxonomy queries. fixes #17054 for trunk

#13 @ryan
5 years ago

(In [17607]) Set is_* flags for AND taxonomy queries. fixes #17054 for 3.1

#14 @scribu
5 years ago

There is no 'NOT' operator for taxonomy queries. The only accepted ones are 'AND', 'IN' and 'NOT IN'.

@scribu
5 years ago

Leave only 'NOT IN' check

@scribu
5 years ago

query flag unit tests

#15 @scribu
5 years ago

  • Keywords has-patch commit added
  • Resolution fixed deleted
  • Status changed from closed to reopened

We really shouldn't leave this in. See 17054.2.diff.

I also wrote some unit tests for query flags, which would catch this bug if it sneaked up again. 50 tests so far.

See unit-query-flags.php.

#16 @ryan
5 years ago

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

(In [17610]) There is not a NOT operator. Props scribu. fixes #17054 for trunk

#17 @ryan
5 years ago

(In [17611]) There is not a NOT operator. Props scribu. fixes #17054 for 3.1

Note: See TracTickets for help on using tickets.