Avoid PHP notices in `redirect_canonical()` and `_wp_menu_item_classes_by_context()` if `$_SERVER['HTTP_HOST']` is not set.

fixes #32229.
Built from https://develop.svn.wordpress.org/trunk@33775


git-svn-id: http://core.svn.wordpress.org/trunk@33743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-08-28 03:31:20 +00:00
parent 1f500055a6
commit 78d43de7e4
3 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
return;
}
if ( !$requested_url ) {
if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
// build the URL in the address bar
$requested_url = is_ssl() ? 'https://' : 'http://';
$requested_url .= $_SERVER['HTTP_HOST'];

View File

@ -553,7 +553,7 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
$active_object = $menu_item->object;
// if the menu item corresponds to the currently-requested URL
} elseif ( 'custom' == $menu_item->object ) {
} elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33774';
$wp_version = '4.4-alpha-33775';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.