WordPress.org

Make WordPress Core

Ticket #5160: wp-setting3.diff

File wp-setting3.diff, 1.2 KB (added by snakefoot, 11 years ago)

Patch for trunk (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         else
    40         {
    41                 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
    42                 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
    43                         $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
    44                 else
    45                         $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
     39        // Simulate REQUEST_URI for IIS
     40        else {
     41                $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
    4642
     43                if (isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO']))
     44                {
     45                        // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
     46                        if ( $_SERVER['PATH_INFO'] !== $_SERVER['SCRIPT_NAME'] )
     47                        {
     48                                $_SERVER['REQUEST_URI'] .= $_SERVER['PATH_INFO'];
     49                        }
     50                }
     51
    4752                // Append the query string if it exists and isn't null
    4853                if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
    4954                        $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];