From e1ecbc841adc301b583f9592fb51d990e1ed154a Mon Sep 17 00:00:00 2001 From: nbachiyski 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: http://svn.automattic.com/wordpress/trunk@13812 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/load.php b/wp-includes/load.php index 06a6ad9b7..826c13768 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'] ) ) ) {