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:
parent
3d67dd8d50
commit
cab7d51114
|
@ -38,6 +38,14 @@ function wp_unregister_GLOBALS() {
|
||||||
*/
|
*/
|
||||||
function wp_fix_server_vars() {
|
function wp_fix_server_vars() {
|
||||||
global $PHP_SELF;
|
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
|
// 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'] ) ) ) {
|
if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue