WordPress.org

Make WordPress Core

Ticket #14292: 14292.2.diff

File 14292.2.diff, 800 bytes (added by ryan, 8 years ago)
  • wp-includes/canonical.php

     
    344344        if ( !$redirect_url || $redirect_url == $requested_url )
    345345                return false;
    346346
     347        // Hex encoded octets are case-insensitive.
     348        if ( false !== strpos($requested_url, '%') ) {
     349                function lowercase_octets($matches) {
     350                        return strtolower($matches[0]);
     351                }
     352                $requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url);
     353        }
     354
    347355        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
    348356        $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url);
    349357