WordPress.org

Make WordPress Core

Ticket #18165: 18165.patch

File 18165.patch, 1.0 KB (added by kurtpayne, 3 years ago)

No longer require cgi.fix_pathinfo = 1

  • wp-includes/load.php

     
    7979        } 
    8080 
    8181        // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 
    82         if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) 
     82        if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( preg_match('/php\d*\.cgi$/', $_SERVER['SCRIPT_FILENAME']) ) ) 
    8383                $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 
    8484 
    8585        // Fix for Dreamhost and other PHP as CGI hosts 
    86         if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) 
     86        if ( preg_match( '/php\d*\.cgi$/', $_SERVER['SCRIPT_NAME']) ) 
    8787                unset( $_SERVER['PATH_INFO'] ); 
    8888 
     89        // Fix php.cgi as PHP_SELF 
     90        if ( preg_match( '/php\d*\.cgi$/' , $_SERVER['PHP_SELF'] ) ) 
     91                $_SERVER['PHP_SELF'] = ''; 
     92         
    8993        // Fix empty PHP_SELF 
    9094        $PHP_SELF = $_SERVER['PHP_SELF']; 
    9195        if ( empty( $PHP_SELF ) )