WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/08/2019 08:19:48 PM (2 months ago)
Author:
SergeyBiryukov
Message:

REST API: In get_rest_url(), check if $_SERVER['SERVER_NAME'] is set to avoid a PHP warning in CLI context.

Props paulschreiber.
Fixes #47854.

File:
1 edited

Legend:

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

    r45736 r45771  
    374374    }
    375375
    376     if ( is_ssl() ) {
     376    if ( is_ssl() && isset( $_SERVER['SERVER_NAME'] ) ) {
    377377        // If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS.
    378378        if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
Note: See TracChangeset for help on using the changeset viewer.