Opened 9 months ago

Closed 8 months ago

#21779 closed defect (bug) (fixed)

Querying Taxonomies (Tag) containing the sequence "-נ-" *still* fails.

Reported by: rstern Owned by: nacin
Priority: normal Milestone: 3.5
Component: Query Version:
Severity: normal Keywords: has-patch needs-unit-tests
Cc: pippin@…, mario@…

Description

The issue described in #13413

Still exists on IIS at least and seems to have only ever been fixed for a brief period of time between 3.1 and 3.1.1

Same steps, latest trunk:

  1. Created a Tag "test -נ- end"
  2. Added the Tag to a Post
  3. Pressed that Tag in my Tag Cloud
  4. Get the not Found Message.

System:

  • Windows/IIS 7
  • PHP 5.4.6

Changing the preg_*() calls in parse_tax_query() to include the /u modifier or changing \s to \r\n\t do seem to fix this issue.

Tested WordPress 3.1, 3.1.1, 3.1.4, 3.2, 3.4.1 and latest trunk.

I've tried to track down the history of this bug. It is "fixed" in 3.1, but after 3.1.1 tag queries with the letter nun returned all posts:

The new preg_split() with the problematic \s is in effect, which splits the tag into two (non-existing) terms. Due to a (different) bug fixed in 3.2 all posts are returned.

After 3.2 no posts are returned.

The underlying cause of the bug, unfortunately, has not been fixed.

Attachments (3)

21779.patch (1.7 KB) - added by SergeyBiryukov 9 months ago.
21779.2.patch (1.7 KB) - added by SergeyBiryukov 9 months ago.
21779.3.patch (1007 bytes) - added by SergeyBiryukov 9 months ago.

Download all attachments as: .zip

Change History (14)

  • Cc pippin@… added
  • Cc mario@… added
  • Component changed from General to Query
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.5

Reproduced on IIS 7.5. To reproduce in Apache:

  1. Create a "test -נ- end" tag and add it to a post.
  2. Go to the Posts screen, find that post in the table.
  3. Click "test -נ- end" link in the Tags column.
  4. "No posts found" will be displayed.

Same regex issue as in #11528 and #21625.

Version 0, edited 9 months ago by SergeyBiryukov (next)

The changes in lines 1735 and 2288 are not necessary (cat and author only accept numeric values), added them for consistency.

Actually, cat and author could use wp_parse_id_list() instead (related: #21827).

Since wp_parse_id_list() absint's the IDs, we can remove those from the two foreach loops following the preg_splits for cat and author.

On second thought, 21779.2.patch would break category exclusion.

I guess it's better to leave cat and author as is and just fix the issue with tags (21779.3.patch).

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

In [21862]:

Split tag names by [\r\n\t ] rather than \s to avoid that character class from eating characters. props rstern, SergeyBiryukov. fixes #21779. see #13413.

  • Keywords needs-unit-tests added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening to possibly get some unit test coverage. We should be able to do $query = new WP_Query; $this->parse_tax_query( $qvs ); with the right query variables, then test to see what we ended up with.

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.