WordPress.org

Make WordPress Core

#21779 closed defect (bug) (fixed)

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

Reported by: rstern Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch needs-unit-tests
Focuses: Cc:

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 20 months ago.
21779.2.patch (1.7 KB) - added by SergeyBiryukov 20 months ago.
21779.3.patch (1007 bytes) - added by SergeyBiryukov 20 months ago.

Download all attachments as: .zip

Change History (14)

comment:1 mordauk20 months ago

  • Cc pippin@… added

comment:2 nofearinc20 months ago

  • Cc mario@… added

SergeyBiryukov20 months ago

comment:3 SergeyBiryukov20 months ago

  • 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 20 months ago by SergeyBiryukov (next)

comment:4 SergeyBiryukov20 months ago

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

SergeyBiryukov20 months ago

comment:5 SergeyBiryukov20 months ago

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

comment:6 nacin20 months ago

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.

SergeyBiryukov20 months ago

comment:7 SergeyBiryukov20 months ago

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).

comment:8 nacin19 months ago

  • 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.

comment:9 nacin19 months ago

  • 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.

comment:11 nacin19 months ago

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