WordPress.org

Make WordPress Core

Ticket #10186: 10186.patch

File 10186.patch, 1.3 KB (added by peaceablewhale, 6 years ago)
  • vars.php

     
    6565 * Whether the server software is Apache or something else 
    6666 * @global bool $is_apache 
    6767 */ 
    68 $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false); 
     68$is_apache = (preg_match('/(?:Apache|LiteSpeed)(?:\/(\d+(?:\.\d+)?))?/', $_SERVER['SERVER_SOFTWARE'], $apache_version) === 1); 
    6969 
    7070/** 
    7171 * Whether the server software is IIS or something else 
    7272 * @global bool $is_IIS 
    7373 */ 
    74 $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false); 
     74$is_IIS = (preg_match('/Microsoft-IIS(?:\/(\d+(?:\.\d+)?))?/', $_SERVER['SERVER_SOFTWARE'], $iis_version) === 1); 
    7575 
    7676/** 
     77 * Server version number 
     78 * @global float|null $server_version 
     79 */ 
     80 
     81$server_version = (isset($apache_version[1]) ? (float)$apache_version[1] : (isset($iis_version[1]) ? (float)$iis_version[1] : null)); 
     82 
     83/** 
    7784 * Whether the server software is IIS 7.X 
    7885 * @global bool $is_iis7 
    7986 */ 
    80 $is_iis7 = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false); 
     87$is_iis7 = ($is_IIS === true && $server_version >= 7 && $server_version <8); 
    8188 
    82  
    8389?> 
    84  No newline at end of file