10000 [Security][Guard] check if session exist before using it by pasdeloup · Pull Request #19218 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security][Guard] check if session exist before using it #19218

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

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
fix CS on old code according to fabbot.io
  • Loading branch information
pasdeloup committed Jun 29, 2016
commit 473bb7ff1736f96b7d9a420bea97c581136222ce
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
// if the user hit a secure page and start() was called, this was
// the URL they were on, and probably where you want to redirect to
if ($request->getSession() instanceof SessionInterface) {
$targetPath = $request->getSession()->get('_security.' . $providerKey . '.target_path');
$targetPath = $request->getSession()->get('_security.'.$providerKey.'.target_path');
}

if (!isset($targetPath) || !$targetPath) {
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to explicitly initialize $targetPath to nullabove and make a check on null here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done.
I also improved the tests.

Expand Down
0