[wp-trac] [WordPress Trac] #21602: redirect_canonical can lead to infinite loop on index navigation if site url is not all lower case

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 27 23:36:56 UTC 2012


#21602: redirect_canonical can lead to infinite loop on index navigation if site
url is not all lower case
--------------------------+------------------------------
 Reporter:  sreedoap      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Canonical     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:7 nacin]:
 > I haven't tracked down what exactly fails to trigger an infinite
 redirect

 `home_url('/')` returns `http://trunk.WordPress/`, `wp_redirect()` fires,
 browser converts that to `http://trunk.wordpress/`, and the loop starts
 again.

 There's a block in line 375 (introduced in [6097] for #4773) to prevent
 exactly this situation:
 http://core.trac.wordpress.org/browser/tags/3.4.1/wp-
 includes/canonical.php#L375

 However, it doesn't seem to work as intended. As far as I can see, the
 purpose of the block is to discard the differences in host capitalization,
 so there shouldn't be a redirect in this case.

 What happens instead is `$compare_original` and `$compare_redirect` end up
 being the same, `$redirect_url` is not rewritten, and the redirect
 proceeds.

 [attachment:21602.patch] moves the block lower, after `$compare_original`
 and `$compare_redirect` are filled.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21602#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list