From a8500226355ac329b3b49872b03bebc4cd3f04a5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 24 May 2019 01:46:16 +0000 Subject: [PATCH] Bootstrap/Load: In `wp_get_server_protocol()`, check if `$_SERVER['SERVER_PROTOCOL']` is defined, to avoid a notice in CLI context. Props thakkarhardik, malthert. Fixes #47005. git-svn-id: https://develop.svn.wordpress.org/trunk@45400 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/load.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 7c9c2e7757..fe97810ae5 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -13,7 +13,7 @@ * @return string The HTTP protocol. Default: HTTP/1.0. */ function wp_get_server_protocol() { - $protocol = $_SERVER['SERVER_PROTOCOL']; + $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : ''; if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) { $protocol = 'HTTP/1.0'; }