Skip to content

Commit

Permalink
getCredentials returns null if incomplete.
Browse files Browse the repository at this point in the history
If the colon is missing (in `user:password`), `getCredentials` will
return an array of one value instead of null whereas this is incorrect.
We then check that the credentials form a pair of two values.
  • Loading branch information
Hywan committed Mar 19, 2015
1 parent c759b9d commit c0a71ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Auth/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ function getCredentials() {
return null;
}

return explode(':',base64_decode(substr($auth, 6)), 2);
$credentials = explode(':',base64_decode(substr($auth, 6)), 2);

if (2 !== count($credentials)) {
return null;
}

return $credentials;

}

Expand Down

0 comments on commit c0a71ac

Please sign in to comment.