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
This commit is contained in:
nbachiyski 2010-03-25 15:33:35 +00:00
parent d2643077d7
commit e1ecbc841a
1 changed files with 8 additions and 0 deletions

View File

@ -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'] ) ) ) {