Skip to content

Commit

Permalink
Check that getallheaders has returned an array
Browse files Browse the repository at this point in the history
Closes WP-API#209
  • Loading branch information
ericnicolaas authored Aug 28, 2017
1 parent 30e4339 commit 20580bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/class-wp-rest-oauth1.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public function get_authorization_header() {
$headers = getallheaders();

// Check for the authoization header case-insensitively
foreach ( $headers as $key => $value ) {
if ( strtolower( $key ) === 'authorization' ) {
return $value;
if ( is_array( $headers ) ) {
foreach ( $headers as $key => $value ) {
if ( strtolower( $key ) === 'authorization' ) {
return $value;
}
}
}
}
Expand Down

0 comments on commit 20580bf

Please sign in to comment.