Opened 6 years ago
Closed 6 years ago
#47005 closed defect (bug) (fixed)
check if SERVER_PROTOCOL is empty in load.php
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | 5.2 |
Component: | Bootstrap/Load | Keywords: | has-patch |
Focuses: | Cc: |
Description
In php cli requests, the server_protocol may not be set, throwing a notice
This should be changed in /wp-includes/wp-load.php
function wp_get_server_protocol() { $protocol = $_SERVER['SERVER_PROTOCOL']; if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) { $protocol = 'HTTP/1.0'; } return $protocol; }
to this:
function wp_get_server_protocol() { $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : ''; if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) { $protocol = 'HTTP/1.0'; } return $protocol; }
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Yes @malthert , it did throw a warning. I have added a patch as per your suggestion.