WordPress.org

Make WordPress Core

Ticket #5160: wp-setting_23.diff

File wp-setting_23.diff, 1.2 KB (added by snakefoot, 6 years ago)

Patch for branch 2.3 (Updated with check if PATH_INFO is empty)

  • wp-settings.php

     
    3636        else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 
    3737                $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 
    3838        } 
     39        // Simulate REQUEST_URI for IIS 
    3940        else { 
    40                 // If root then simulate that no script-name was specified 
    41                 if (empty($_SERVER['PATH_INFO'])) 
    42                         $_SERVER['REQUEST_URI'] = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')) . '/'; 
    43                 elseif ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 
     41                $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; 
     42 
     43                if (isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO'])) 
     44                { 
    4445                        // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 
    45                         $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 
    46                 else 
    47                         $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 
     46                        if ( $_SERVER['PATH_INFO'] !== $_SERVER['SCRIPT_NAME'] ) 
     47                        { 
     48                                $_SERVER['REQUEST_URI'] .= $_SERVER['PATH_INFO']; 
     49                        } 
     50                } 
    4851 
    4952                // Append the query string if it exists and isn't null 
    5053                if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {