diff --git src/wp-includes/canonical.php src/wp-includes/canonical.php
index 58723ebc0d..52c04a8cdd 100644
|
|
|
function redirect_canonical( $requested_url = null, $do_redirect = true ) { |
| 69 | 69 | // Build the URL in the address bar. |
| 70 | 70 | $requested_url = is_ssl() ? 'https://' : 'http://'; |
| 71 | 71 | $requested_url .= $_SERVER['HTTP_HOST']; |
| 72 | | $requested_url .= $_SERVER['REQUEST_URI']; |
| | 72 | $requested_url .= isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : ''; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $original = parse_url( $requested_url ); |
diff --git src/wp-includes/class-wp-xmlrpc-server.php src/wp-includes/class-wp-xmlrpc-server.php
index c5a4eba66e..f09798cf2a 100644
|
|
|
class wp_xmlrpc_server extends IXR_Server { |
| 4895 | 4895 | return $blogs; |
| 4896 | 4896 | } |
| 4897 | 4897 | |
| 4898 | | if ( $_SERVER['HTTP_HOST'] === $domain && $_SERVER['REQUEST_URI'] === $path ) { |
| | 4898 | if ( ( isset( $_SERVER['HTTP_HOST'] ) && $_SERVER['HTTP_HOST'] === $domain ) && ( isset( _SERVER['REQUEST_URI'] ) && $_SERVER['REQUEST_URI'] === $path ) ) { |
| 4899 | 4899 | return $blogs; |
| 4900 | 4900 | } else { |
| 4901 | 4901 | foreach ( (array) $blogs as $blog ) { |
diff --git src/wp-includes/class-wp.php src/wp-includes/class-wp.php
index f2b114e708..19a58a1e73 100644
|
|
|
class WP { |
| 172 | 172 | $pathinfo = str_replace( '%', '%25', $pathinfo ); |
| 173 | 173 | |
| 174 | 174 | list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] ); |
| 175 | | $self = $_SERVER['PHP_SELF']; |
| | 175 | $self = isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : ''; |
| 176 | 176 | |
| 177 | 177 | $home_path = parse_url( home_url(), PHP_URL_PATH ); |
| 178 | 178 | $home_path_regex = ''; |
diff --git src/wp-includes/load.php src/wp-includes/load.php
index 0526cb175d..7191f27609 100644
|
|
|
function wp_fix_server_vars() { |
| 60 | 60 | |
| 61 | 61 | // Some IIS + PHP configurations put the script-name in the path-info (no need to append it twice). |
| 62 | 62 | if ( isset( $_SERVER['PATH_INFO'] ) ) { |
| 63 | | if ( $_SERVER['PATH_INFO'] === $_SERVER['SCRIPT_NAME'] ) { |
| | 63 | if ( isset( $_SERVER['SCRIPT_NAME'] ) && $_SERVER['PATH_INFO'] === $_SERVER['SCRIPT_NAME'] ) { |
| 64 | 64 | $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; |
| 65 | 65 | } else { |
| 66 | 66 | $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; |
| … |
… |
function wp_fix_server_vars() { |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Append the query string if it exists and isn't null. |
| 71 | | if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { |
| | 71 | if ( isset( $_SERVER['QUERY_STRING'] ) && ! empty( $_SERVER['QUERY_STRING'] ) ) { |
| 72 | 72 | $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
| 73 | 73 | } |
| 74 | 74 | } |
| … |
… |
function wp_fix_server_vars() { |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Fix empty PHP_SELF. |
| 88 | | $PHP_SELF = $_SERVER['PHP_SELF']; |
| | 88 | $PHP_SELF = isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : ''; |
| 89 | 89 | if ( empty( $PHP_SELF ) ) { |
| 90 | 90 | $_SERVER['PHP_SELF'] = preg_replace( '/(\?.*)?$/', '', $_SERVER['REQUEST_URI'] ); |
| 91 | | $PHP_SELF = $_SERVER['PHP_SELF']; |
| | 91 | $PHP_SELF = isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : ''; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | wp_populate_basic_auth_from_authorization_header(); |
| … |
… |
function wp_is_development_mode( $mode ) { |
| 379 | 379 | * @deprecated 5.4.0 Deprecated in favor of do_favicon(). |
| 380 | 380 | */ |
| 381 | 381 | function wp_favicon_request() { |
| 382 | | if ( '/favicon.ico' === $_SERVER['REQUEST_URI'] ) { |
| | 382 | if ( isset( $_SERVER['REQUEST_URI'] ) && '/favicon.ico' === $_SERVER['REQUEST_URI'] ) { |
| 383 | 383 | header( 'Content-Type: image/vnd.microsoft.icon' ); |
| 384 | 384 | exit; |
| 385 | 385 | } |
diff --git src/wp-includes/ms-deprecated.php src/wp-includes/ms-deprecated.php
index 5a6b4415ed..3e5d23bc57 100644
|
|
|
function get_blogaddress_by_domain( $domain, $path ) { |
| 370 | 370 | if ( is_subdomain_install() ) { |
| 371 | 371 | $url = "http://" . $domain.$path; |
| 372 | 372 | } else { |
| 373 | | if ( $domain != $_SERVER['HTTP_HOST'] ) { |
| | 373 | if ( isset( $_SERVER['HTTP_HOST'] ) && $domain != $_SERVER['HTTP_HOST'] ) { |
| 374 | 374 | $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); |
| 375 | 375 | $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; |
| 376 | 376 | // We're not installing the main blog. |
diff --git src/wp-includes/ms-settings.php src/wp-includes/ms-settings.php
index c665da17e3..818d692c58 100644
|
|
|
ms_subdomain_constants(); |
| 59 | 59 | // have not been populated in the global scope through something like `sunrise.php`. |
| 60 | 60 | if ( ! isset( $current_site ) || ! isset( $current_blog ) ) { |
| 61 | 61 | |
| 62 | | $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); |
| | 62 | $domain = isset( $_SERVER['HTTP_HOST'] ) ? strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ) : ''; |
| 63 | 63 | if ( str_ends_with( $domain, ':80' ) ) { |
| 64 | 64 | $domain = substr( $domain, 0, -3 ); |
| 65 | | $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); |
| | 65 | $_SERVER['HTTP_HOST'] = isset( $_SERVER['HTTP_HOST'] ) ? substr( $_SERVER['HTTP_HOST'], 0, -3 ) : ''; |
| 66 | 66 | } elseif ( str_ends_with( $domain, ':443' ) ) { |
| 67 | 67 | $domain = substr( $domain, 0, -4 ); |
| 68 | | $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); |
| | 68 | $_SERVER['HTTP_HOST'] = isset( $_SERVER['HTTP_HOST'] ) ? substr( $_SERVER['HTTP_HOST'], 0, -4 ) : ''; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $path = stripslashes( $_SERVER['REQUEST_URI'] ); |
diff --git src/wp-includes/theme-previews.php src/wp-includes/theme-previews.php
index 7e0c085b1c..eaff5a0525 100644
|
|
|
function wp_block_theme_activate_nonce() { |
| 84 | 84 | * @since 6.3.2 |
| 85 | 85 | */ |
| 86 | 86 | function wp_initialize_theme_preview_hooks() { |
| 87 | | if ( ! empty( $_GET['wp_theme_preview'] ) ) { |
| | 87 | if ( isset( $_GET['wp_theme_preview'] ) && ! empty( $_GET['wp_theme_preview'] ) ) { |
| 88 | 88 | add_filter( 'stylesheet', 'wp_get_theme_preview_path' ); |
| 89 | 89 | add_filter( 'template', 'wp_get_theme_preview_path' ); |
| 90 | 90 | add_action( 'init', 'wp_attach_theme_preview_middleware' ); |