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
This commit is contained in:
Nikolay Bachiyski 2010-03-25 15:33:35 +00:00
parent 3d67dd8d50
commit cab7d51114
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'] ) ) ) {