From 05d4b6858624df50c51078887fbb350f70e1c6ae Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 10 May 2013 23:00:47 -0700 Subject: [PATCH] Optimised regex and re-added trim() following conversation in #52 --- src/League/OAuth2/Server/Resource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/League/OAuth2/Server/Resource.php b/src/League/OAuth2/Server/Resource.php index be902208..849f481c 100644 --- a/src/League/OAuth2/Server/Resource.php +++ b/src/League/OAuth2/Server/Resource.php @@ -251,9 +251,9 @@ class Resource // 2nd request: Authorization: Bearer XXX, Bearer XXX if (strpos($header, ',') !== false) { $headerPart = explode(',', $header); - $accessToken = preg_replace('/^(?:\s+)?Bearer(\s{1})/', '', $headerPart[0]); + $accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $headerPart[0])); } else { - $accessToken = preg_replace('/^(?:\s+)?Bearer(\s{1})/', '', $header); + $accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header)); } $accessToken = ($accessToken === 'Bearer') ? '' : $accessToken; } else {