Make WordPress Core

Changeset 45400


Ignore:
Timestamp:
05/24/2019 01:46:16 AM (6 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r45350 r45400  
    1414 */
    1515function wp_get_server_protocol() {
    16     $protocol = $_SERVER['SERVER_PROTOCOL'];
     16    $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
    1717    if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
    1818        $protocol = 'HTTP/1.0';
Note: See TracChangeset for help on using the changeset viewer.