Skip to content

Commit

Permalink
[Security] fix check for empty usernames
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 22, 2015
1 parent 510b2d2 commit 6585fe4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Expand Up @@ -36,7 +36,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface
*/
public function __construct($username, $class)
{
if (empty($username)) {
if ('' === $username || null === $username) {
throw new \InvalidArgumentException('$username must not be empty.');
}
if (empty($class)) {
Expand Down
Expand Up @@ -62,7 +62,7 @@ public function authenticate(TokenInterface $token)
}

$username = $token->getUsername();
if (empty($username)) {
if ('' === $username || null === $username) {
$username = 'NONE_PROVIDED';
}

Expand Down
Expand Up @@ -40,7 +40,7 @@ public function __construct($class, $username, $series, $tokenValue, \DateTime $
if (empty($class)) {
throw new \InvalidArgumentException('$class must not be empty.');
}
if (empty($username)) {
if ('' === $username || null === $username) {
throw new \InvalidArgumentException('$username must not be empty.');
}
if (empty($series)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Security/Core/User/User.php
Expand Up @@ -30,7 +30,7 @@ final class User implements AdvancedUserInterface

public function __construct($username, $password, array $roles = array(), $enabled = true, $userNonExpired = true, $credentialsNonExpired = true, $userNonLocked = true)
{
if (empty($username)) {
if ('' === $username || null === $username) {
throw new \InvalidArgumentException('The username cannot be empty.');
}

Expand Down

0 comments on commit 6585fe4

Please sign in to comment.