Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17194 closed defect (bug) (fixed)

Term intersection requests ignore non-existent terms.

Reported by: ryan's profile ryan Owned by: scribu's profile scribu
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

Perform a term intersection such as tag=foo+bar. If foo doesn't exist then bar is queried solo, thus reducing the request to tag=bar. Intersections that include terms that do not exist should not return any terms.

Attachments (2)

17194.diff (5.7 KB) - added by scribu 13 years ago.
17194.2.diff (5.8 KB) - added by scribu 13 years ago.
Use WP_Error instead of exceptions

Download all attachments as: .zip

Change History (12)

#1 @scribu
13 years ago

I thought I fixed this. Obviously not.

#2 @ryan
13 years ago

It was fixed for unions. Intersections seem to have slipped through.

#3 @scribu
13 years ago

  • Owner set to scribu
  • Status changed from new to accepted

#4 @scribu
13 years ago

Sort of related: #17199

@scribu
13 years ago

#5 @scribu
13 years ago

I ended up using exceptions, since otherwise I would have to check for an error after each call to tranform_query(). I'm not a big fan of exception handling, but in self-contained cases like this, they come in handy.

#6 @nacin
13 years ago

We should stick to WP_Error usage. No need to introduce an exception here.

#7 follow-up: @scribu
13 years ago

As I said, the point of using exceptions here is to avoid error checking at each step. You can't do that with WP_Error, unless it's made throwable.

Last edited 13 years ago by scribu (previous) (diff)

#8 in reply to: ↑ 7 @westi
13 years ago

Replying to scribu:

As I said, the point of using exceptions here is to avoid error checking at each step. You can't do that with WP_Error, unless it's made throwable.

Yes. But using WP_Error and checking for it makes the code flow explicit and more readable and it how WordPress works.

#9 @scribu
13 years ago

  • Keywords has-patch added

17194.2.diff uses WP_Error.

@scribu
13 years ago

Use WP_Error instead of exceptions

#10 @ryan
13 years ago

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

(In [17686]) Handle term intersection requests containg inexistent terms. Props scribu. fixes #17194

Note: See TracTickets for help on using tickets.