[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 noreply at wordpress.org
Sat Jan 9 07:25:39 UTC 2016


#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:  4.4.2
Component:  Canonical                       |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  needs-unit-tests needs-refresh  |     Focuses:
--------------------------------------------+--------------------
Changes (by dd32):

 * milestone:  Awaiting Review => 4.4.2


Comment:

 > 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.

 The existing check actually works as intended, The host capitalisation
 differences are ignored when a redirect '''will''' happen.
 Unfortunately in the case where the only difference ''is'' the
 capitalization, it's not caught as `$redirect_url` doesn't get modified,
 which is later used for the comparison (Skipping the `$redirect_url`
 rebuilding which occurs and effectively `strtolower()`'s it).

 I think the only thing that's needed here is adding the `else` branch,
 like so:
 {{{
         if ( $compare_original !== $compare_redirect ) {
                 $redirect_url =....rebuild
         } else {
                 $redirect_url = false;
         }
 }}}

 I'm pulling this into 4.4.2, as we've triggered this issue through [36129]

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


More information about the wp-trac mailing list