Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
pasdeloup wants to merge9 commits intosymfony:2.8fromSedona-Solutions:fix/18958
Closed

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

pasdeloup wants to merge9 commits intosymfony:2.8fromSedona-Solutions:fix/18958

Conversation

@pasdeloup
Copy link
Contributor

QA
Branch?2.8
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#18958
LicenseMIT
Doc PR-

As stated by@Shekhovtsovy when the Guard component is used without the Symfony full stack (for instance in Laravel), $request->getSession() may be null.

An additionnal PR will be needed for 3.1 but it may be better to check this one before.

@xabbuh
Copy link
Member

Can you please add a test covering the fix?

@pasdeloup
Copy link
ContributorAuthor

Ok, I will add it.
And I'm surprised to see current tests are not passing on Travis and I don't understand the errors. I'm not sure it's related to this PR, I will check.

@pasdelouppasdeloup changed the titlecheck if session exist before using it[Security][Guard] check if session exist before using itJun 29, 2016
@pasdeloup
Copy link
ContributorAuthor

Ok tests added.
And I rebased to get nicolas-grekas fix for fixtures so tests should pass now.

@pasdeloup
Copy link
ContributorAuthor

AppVeyor is not passing :(
but seems not related to this PR

@pasdeloup
Copy link
ContributorAuthor

And now AppVeyor is passing, strange...

/**
* @author Jean Pasdeloup <jpasdeloup@sedona.fr>
*/
class MockFormLoginAuthenticator extends AbstractFormLoginAuthenticator
Copy link
Member

Choose a reason for hiding this comment

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

This class should be moved at the bottom of the test file.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Ok, moved

}

if (!$targetPath) {
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 tonullabove and make a check onnull here.

xabbuh reacted with thumbs up emoji
Copy link
ContributorAuthor

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.


public function testAuthenticateWithoutSession()
{
$authenticator = new MockFormLoginAuthenticator();
Copy link
Member

Choose a reason for hiding this comment

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

Why not use a PHPUnit mock instead?

@fabpot
Copy link
Member

Thank you@pasdeloup.

fabpot added a commit that referenced this pull requestJun 30, 2016
…pasdeloup)This PR was squashed before being merged into the 2.8 branch (closes#19218).Discussion----------[Security][Guard] check if session exist before using it| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18958| License       | MIT| Doc PR        | -As stated by@Shekhovtsovy when the Guard component is used without the Symfony full stack (for instance in Laravel), $request->getSession() may be null.An additionnal PR will be needed for 3.1 but it may be better to check this one before.Commits-------a3f7510 [Security][Guard] check if session exist before using it
@fabpotfabpot closed thisJun 30, 2016
This was referencedJul 30, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@pasdeloup@xabbuh@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp