WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 4 months ago

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

Download all attachments as: .zip

Change History (17)

comment:1 @mordauk3 years ago

  • Cc pippin@… added

comment:2 @nofearinc3 years ago

  • Cc mario@… added

@SergeyBiryukov3 years ago

comment:3 @SergeyBiryukov3 years 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 3 years ago by SergeyBiryukov (next)

comment:4 @SergeyBiryukov3 years ago

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

@SergeyBiryukov3 years ago

comment:5 @SergeyBiryukov3 years ago

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

comment:6 @nacin3 years 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.

@SergeyBiryukov3 years ago

comment:7 @SergeyBiryukov3 years 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 @nacin3 years 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 @nacin3 years 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 @nacin3 years ago

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

comment:12 follow-ups: @valendesigns4 months ago

I don't know what changed recently to cause this, but the test_query_tag_nun test is failing in Trunk. Do we reopen this ticket or hunt down where it got broken and comment in that ticket?

comment:13 in reply to: ↑ 12 @SergeyBiryukov4 months ago

Replying to valendesigns:

Do we reopen this ticket or hunt down where it got broken and comment in that ticket?

If the ticket where it was broken is still open (or was closed in the current milestone), leave a comment there. If not, create a new one.

comment:14 in reply to: ↑ 12 @SergeyBiryukov4 months ago

Replying to valendesigns:

I don't know what changed recently to cause this, but the test_query_tag_nun test is failing in Trunk.

Broken in [31051], left a comment on #21212.

Note: See TracTickets for help on using tickets.