WordPress.org

Make WordPress Core

Ticket #14292: 14292.2.patch

File 14292.2.patch, 870 bytes (added by hakre, 5 years ago)

redirect_canonical() can be called multiple times

  • wp-includes/canonical.php

     
    343343 
    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        } 
    346356 
    347357        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE 
    348358        $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url);