WordPress.org

Make WordPress Core

Changeset 15437


Ignore:
Timestamp:
07/18/10 13:46:35 (5 years ago)
Author:
ryan
Message:

Hex octets are case-insenstive. Don't 301 when the only octet case differs. Props hakre. fixes #14292 for 3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r14954 r15437  
    344344    if ( !$redirect_url || $redirect_url == $requested_url ) 
    345345        return false; 
     346         
     347    // Hex encoded octets are case-insensitive.  
     348    if ( false !== strpos($requested_url, '%') ) { 
     349        if ( !function_exists('lowercase_octets') ) { 
     350            function lowercase_octets($matches) {  
     351                return strtolower( $matches[0] );  
     352            }  
     353        } 
     354        $requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url); 
     355    } 
     356 
     357    // Hex encoded octets are case-insensitive. 
     358    if ( false !== strpos($requested_url, '%') ) { 
     359        function lowercase_octets($matches) { 
     360            return strtolower($matches[0]); 
     361        } 
     362        $requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url); 
     363    } 
    346364 
    347365    // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE 
Note: See TracChangeset for help on using the changeset viewer.