Make WordPress Core

Changeset 13812


Ignore:
Timestamp:
03/25/2010 03:33:35 PM (15 years ago)
Author:
nbachiyski
Message:

Set some $_SERVER values to empty strings if missing. Fixes notices if WordPress is run from the command-line and is far more pleasant than using isset() all over the place.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/load.php

    r13770 r13812  
    3939function wp_fix_server_vars() {
    4040    global $PHP_SELF;
     41   
     42    $default_server_values = array(
     43        'SERVER_SOFTWARE' => '',
     44        'REQUEST_URI' => '',
     45    );
     46
     47    $_SERVER = array_merge( $default_server_values, $_SERVER );
     48   
    4149    // Fix for IIS when running with PHP ISAPI
    4250    if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
Note: See TracChangeset for help on using the changeset viewer.