From cab7d51114801722e3fb01a94b0558d262514bae Mon Sep 17 00:00:00 2001 From: Nikolay Bachiyski Date: Thu, 25 Mar 2010 15:33:35 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@13812 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/load.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/load.php b/wp-includes/load.php index 06a6ad9b74..826c137684 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -38,6 +38,14 @@ function wp_unregister_GLOBALS() { */ function wp_fix_server_vars() { global $PHP_SELF; + + $default_server_values = array( + 'SERVER_SOFTWARE' => '', + 'REQUEST_URI' => '', + ); + + $_SERVER = array_merge( $default_server_values, $_SERVER ); + // Fix for IIS when running with PHP ISAPI if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {