WordPress.org

Make WordPress Core

Ticket #41577: canonical.php.patch

File canonical.php.patch, 944 bytes (added by glehner, 2 years ago)
  • canonical.php

    old new  
    7171                return;
    7272        }
    7373
     74        // Notice fixing
     75        if ( !isset($original['path']) )
     76                $original['path'] = '';
     77        if ( !isset($original['query']) )
     78                $original['query'] = '';
     79
    7480        $redirect = $original;
    7581        $redirect_url = false;
    7682
    77         // Notice fixing
    78         if ( !isset($redirect['path']) )
    79                 $redirect['path'] = '';
    80         if ( !isset($redirect['query']) )
    81                 $redirect['query'] = '';
    8283
    8384        // If the original URL ended with non-breaking spaces, they were almost
    8485        // certainly inserted by accident. Let's remove them, so the reader doesn't
     
    567568                if ( ! empty( $parsed_url['port'] ) ) {
    568569                        $url .= ':' . $parsed_url['port'];
    569570                }
    570                 $url .= $parsed_url['path'];
     571                if ( isset( $parsed_url['path'] ) )
     572                        $url .= $parsed_url['path'];
    571573                if ( ! empty( $parsed_url['query'] ) ) {
    572574                        $url .= '?' . $parsed_url['query'];
    573575                }