From 20580bfdcd261c9dae99714ddd5bfc2424702ab1 Mon Sep 17 00:00:00 2001 From: Eric Daams Date: Mon, 28 Aug 2017 11:01:55 +0930 Subject: [PATCH] Check that getallheaders has returned an array Closes #209 --- lib/class-wp-rest-oauth1.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/class-wp-rest-oauth1.php b/lib/class-wp-rest-oauth1.php index 268001f..edc2538 100644 --- a/lib/class-wp-rest-oauth1.php +++ b/lib/class-wp-rest-oauth1.php @@ -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; + } } } }