From 8a7cb8e93bfe3d5220ce50bc8d2aac9e6ce818a2 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 6 Oct 2014 23:38:47 +0200 Subject: [PATCH] Try to fix issue #10; work around bug https://bugs.php.net/bug.php?id=68168 --- lib/oauth.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/oauth.php b/lib/oauth.php index 231a177..41af349 100644 --- a/lib/oauth.php +++ b/lib/oauth.php @@ -160,6 +160,17 @@ class OAuth { //$_SERVER['REDIRECT_HTTP_AUTHORIZATION'] = $_SERVER['HTTP_AUTHORIZATION']; //unset($_SERVER['HTTP_AUTHORIZATION']); + if ((isset($_SERVER['HTTP_AUTHORIZATION']) + && strtolower(substr($_SERVER['HTTP_AUTHORIZATION'], 0, 5)) != 'oauth') + || (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) + && strtolower(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 0, 5)) != 'oauth') + ) { + //work around bug https://bugs.php.net/bug.php?id=68168 + //#68168: HTTP Basic auth reported as "signature_method_rejected" + throw new \OAuthException( + 'No oauth auth header', OAUTH_PARAMETER_ABSENT + ); + } $params = array(); if (!isset($_SERVER['HTTP_AUTHORIZATION']) -- 2.30.2