BasicAuthenticate - code styling and strong type comparison

This commit is contained in:
Nicola Beghin 2017-03-15 13:59:56 +01:00
parent 41851d60b4
commit f5795f05a5

View file

@ -85,9 +85,8 @@ class BasicAuthenticate extends BaseAuthenticate {
if(!isset($_SERVER['PHP_AUTH_USER'])) { if(!isset($_SERVER['PHP_AUTH_USER'])) {
if (isset($_SERVER['HTTP_AUTHORIZATION']) && (strlen($_SERVER['HTTP_AUTHORIZATION']) > 0)) { if (isset($_SERVER['HTTP_AUTHORIZATION']) && (strlen($_SERVER['HTTP_AUTHORIZATION']) > 0)) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
if( strlen($_SERVER['PHP_AUTH_USER']) == 0 || strlen($_SERVER['PHP_AUTH_PW']) == 0 ) { if(strlen($_SERVER['PHP_AUTH_USER']) === 0 || strlen($_SERVER['PHP_AUTH_PW']) === 0) {
unset($_SERVER['PHP_AUTH_USER']); unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
unset($_SERVER['PHP_AUTH_PW']);
} }
} }
} }