Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix authentification manager wrong if statement usage #306

Closed
wants to merge 1 commit into from

Conversation

Webonaute
Copy link

No description provided.

@@ -224,7 +224,7 @@ public function handleHelloMessage(Realm $realm, Session $session, HelloMessage
}

// If no authentication providers are registered for this realm send an abort message
if ($this->realmHasAuthProvider($realm->getRealmName())) {
if ($this->realmHasAuthProvider($realm->getRealmName()) === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Webonaute Has this actually caused an issue for you? realmHasAuthProver can only return a boolean:

private function realmHasAuthProvider($realmName)
{
foreach ($this->authMethods as $authMethod) {
foreach ($authMethod['auth_realms'] as $authRealm) {
if ($authRealm === "*" || $authRealm === $realmName) {
return true;
}
}
}
return false;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the comment just over the line than read the original if statement. :)

As soon as you set a auth it will never go in auth code under those line.

And somevar === false is lot more easy and clear to read than !somevar

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to my issue here voryx/ThruwayBundle#88

@Webonaute
Copy link
Author

Nvm just read more. I wrong interpreted the next lines.

@Webonaute Webonaute closed this Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants