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
This commit is contained in:
Sergey Biryukov 2019-05-24 01:46:16 +00:00
parent 630f4bc1ea
commit a850022635

View File

@ -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';
}