[wp-trac] [WordPress Trac] #43539: Custom feed types breaks redirect_canonical behavior

WordPress Trac noreply at wordpress.org
Sat Mar 17 19:24:13 UTC 2018


#43539: Custom feed types breaks redirect_canonical behavior
------------------------------------------+------------------------------
 Reporter:  satantime                     |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Canonical                     |     Version:  4.9.4
 Severity:  normal                        |  Resolution:
 Keywords:  needs-unit-tests needs-patch  |     Focuses:
------------------------------------------+------------------------------
Changes (by soulseekah):

 * keywords:   => needs-unit-tests needs-patch


Comment:

 I do see that the `$redirect_url` value in there is set to
 `http://stream.localhost/feed/test/feed/test/` and canonical intends to do
 a redirect. But `redirect_canonical()` returns false, and end of story.

 So question is:

 1. Why does `redirect_canonical()` think it needs to do a redirect?
 2. And then why does the nested call to `redirect_canonical()` think that
 it no longer needs to do a redirect?

 I do agree that `redirect_canonical()` should not even reach down there,
 `$do_redirect` should not be set, and the function has to bail very early.

 Moreover shouldn't the canonical URL be set to `feed/test/` with a
 trailing slash. Might be what it's trying to do, but with some luck it
 seems that it prevents a redirect loop.

 This is a good issue. Thanks for the explanation, although the story of
 how you came about to learn about it, seeing how it's all hidden and
 everything is still going to bug me for a long  time :)

 Seems to be a valid bug, without an apparent manifestation (some sort of
 redirect loop protection is kicking in). I'll look into this more tomorrow
 and you and I will figure out a good fix, and more importantly tests for
 this. But do explain how you found out about this bug, please! :)

 Cheers.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43539#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list