From 465c1c6ab2a4508ef4410488c1267329aa64366b Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 24 Aug 2012 12:25:31 +0100 Subject: [PATCH] Wrapped getallheaders() method in function_exists (function isn't available on command line) --- src/Oauth2/Resource/Server.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Oauth2/Resource/Server.php b/src/Oauth2/Resource/Server.php index ab4626c3..46982a86 100644 --- a/src/Oauth2/Resource/Server.php +++ b/src/Oauth2/Resource/Server.php @@ -127,13 +127,15 @@ class Server } // Try and get an access token from the auth header - $headers = getallheaders(); - if (isset($headers['Authorization'])) { + if (function_exists('getallheaders')) { + $headers = getallheaders(); + if (isset($headers['Authorization'])) { - $rawToken = trim(str_replace('Bearer', '', $headers['Authorization'])); - if ( ! empty($rawToken)) - { - $accessToken = base64_decode($rawToken); + $rawToken = trim(str_replace('Bearer', '', $headers['Authorization'])); + if ( ! empty($rawToken)) + { + $accessToken = base64_decode($rawToken); + } } }