From 78d43de7e487381581e511eeecf5c56c5b445f26 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 28 Aug 2015 03:31:20 +0000 Subject: [PATCH] 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 --- wp-includes/canonical.php | 2 +- wp-includes/nav-menu-template.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index f75a72eea3..4caaa656fe 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -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']; diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index bcc9b6325c..7a61031a16 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -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; diff --git a/wp-includes/version.php b/wp-includes/version.php index 676d058a80..554a97cc00 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.