Make WordPress Core

Changeset 33775


Ignore:
Timestamp:
08/28/2015 03:30:55 AM (11 years ago)
Author:
SergeyBiryukov
Message:

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

fixes #32229.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/canonical.php

    r32568 r33775  
    6060    }
    6161
    62     if ( !$requested_url ) {
     62    if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
    6363        // build the URL in the address bar
    6464        $requested_url  = is_ssl() ? 'https://' : 'http://';
  • trunk/src/wp-includes/nav-menu-template.php

    r33585 r33775  
    554554
    555555        // if the menu item corresponds to the currently-requested URL
    556         } elseif ( 'custom' == $menu_item->object ) {
     556        } elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
    557557            $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
    558558            $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
Note: See TracChangeset for help on using the changeset viewer.