From 2aa8ce5bc597a857a2bd24382d1cfcfb13bf2ed1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 8 Aug 2019 20:20:55 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@45771 git-svn-id: http://core.svn.wordpress.org/trunk@45582 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index 7602dd7405..5ec557547c 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -373,7 +373,7 @@ function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) { $url = add_query_arg( 'rest_route', $path, $url ); } - if ( is_ssl() ) { + if ( is_ssl() && isset( $_SERVER['SERVER_NAME'] ) ) { // If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS. if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) { $url = set_url_scheme( $url, 'https' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 034cc856c7..4142bc0fc9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45770'; +$wp_version = '5.3-alpha-45771'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.