Make WordPress Core

Opened 15 years ago

Last modified 2 weeks ago

#17661 new defect (bug)

Appending date & author based query vars to a permalink overrides the permalink

Reported by: dd32's profile dd32 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Canonical Keywords: has-patch needs-unit-tests needs-refresh
Focuses: Cc:

Description

Some canonical code branches are not properly accounting for extra query variables being specified via the url.

For example, these url's are not handled properly:

/2008/?author=1 redirects to /author/admin/
/author/admin/?year=2008 redirects to /year/2008/
/category/uncategorized/?year=2008 redirects to /2008/

This happens with most date based branches, as once a higher priority canonical rule is hit, the permalink component is ignored.

The canonical code includes a branch to add any "forgotten" $_GET variables back onto the url, however this doesn't help when it's the rewritten variables are being lost.

Attachments (3)

fix-canonical-by-matched-query.diff (2.2 KB) - added by wonderboymusic 13 years ago.
17661.diff (2.8 KB) - added by wonderboymusic 13 years ago.
17661-tests.patch (3.4 KB) - added by boonebgorges 11 years ago.
Removing from trunk as per #30284

Download all attachments as: .zip

Change History (8)

#1 @wonderboymusic
13 years ago

  • Keywords needs-testing has-patch added; needs-patch removed

This is probably happening in a million other combinations as well - here's the problem:

1) the flags for is_* are misleading because they are set to true for every present query var, regardless of rewrite structure

2) the redirection happens because redirect_canonical() says "I'm a year! and the year is in the query string when I want pretty permalinks, redirect me!" - it doesn't, however, check if the year is also the matched query or not.

3) /2012/?year=2012 and /?year=2012 should be redirected to /2012/, /{NOT_YEAR}/?year=2012 should not

My patch fixes this for this ticket's use cases - I'm sure there are other cases which could be addressed.

#2 @wonderboymusic
13 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Future Release to 3.7

#3 @nacin
12 years ago

  • Milestone changed from 3.7 to Future Release

Keywords needs-unit-tests added

@boonebgorges
11 years ago

Removing from trunk as per #30284

#4 @chriscct7
10 years ago

  • Keywords needs-refresh added

#5 @huzaifaalmesbah
2 weeks ago

  • Keywords needs-testing removed

I attempted to apply the available patches against trunk (7.0-alpha-61215-src).

Both 17661.diff and 17661-tests.patch failed to apply cleanly, with multiple reject files generated.

Given the age of these patches and changes in canonical and related code since then, the patches appear to be outdated and need to be refreshed against current trunk.

Since the patches cannot currently be tested, I have removed the needs-testing keyword. This ticket already has `needs-

Note: See TracTickets for help on using tickets.