diff --git a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php index 8e98fda21..b7daa74f4 100644 --- a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php @@ -82,12 +82,9 @@ class BasicAuthenticate extends BaseAuthenticate { * @return mixed Either false or an array of user information */ public function getUser(CakeRequest $request) { - $username = ''; - $pass = ''; - if (isset($_SERVER['PHP_AUTH_USER'])) { - $username = env('PHP_AUTH_USER'); - $pass = env('PHP_AUTH_PW'); - } else { + $username = env('PHP_AUTH_USER'); + $pass = env('PHP_AUTH_PW'); + if (empty($username)) { $httpAuthorization = $request->header('Authorization'); if ($httpAuthorization !== false && strlen($httpAuthorization) > 0 && strpos($httpAuthorization, 'Basic') !== false) { list($username, $pass) = explode(':', base64_decode(substr($httpAuthorization, 6)));