WordPress.org

Make WordPress Core

Opened 18 months ago

Last modified 6 months ago

#46061 new defect (bug)

Canonical prevents accessing paginated results of feed-named tags

Reported by: dd32 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Canonical Keywords: needs-patch
Focuses: Cc:

Description

Given a tag of the name 'rss' (or any of (feed|rss|rdf|atom|rss2)) Canonical will cause a redirect for a paginated result to an incorrect url lacking the 'rss'

For example:

$ curl -Is http://wordpress.dev/tag/rss/page/2/ | grep Location
Location: http://wordpress.dev/tag/page/2/

This appears to be caused by https://core.trac.wordpress.org/browser/trunk/src/wp-includes/canonical.php?rev=43571&marks=297-302#L290

This was originally reported as https://meta.trac.wordpress.org/ticket/2945

Attachments (1)

46061-tests.diff (2.2 KB) - added by tellyworth 6 months ago.

Download all attachments as: .zip

Change History (4)

This ticket was mentioned in Slack in #slackhelp by tobifjellner. View the logs.


18 months ago

#2 @tellyworth
6 months ago

attachment:46061-tests.diff adds unit test cases to reproduce the problem. Example output:

There were 3 failures:

1) Tests_Canonical::test_canonical with data set #11 ('/tag/feed/page/2/', array('/tag/feed/page/2/', array('foo', '2')), 46061)
Ticket #46061
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/tag/feed/page/2/'
+'/tag/page/2/'

2) Tests_Canonical::test_canonical with data set #12 ('/tag/rss/page/2/', array('/tag/rss/page/2/', array('rss', '2')), 46061)
Ticket #46061
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/tag/rss/page/2/'
+'/tag/page/2/'

3) Tests_Canonical::test_canonical with data set #13 ('/category/atom/page/2/', array('/category/atom/page/2/', array('feed', '2')), 46061)
Ticket #46061
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/category/atom/page/2/'
+'/category/page/2/'

Note that this is a similar bug to #39535.

Note: See TracTickets for help on using tickets.