Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ensure $request->hasSession() is always checked before calling getSession() #32703

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

Merged
merged 1 commit into from
Jul 30, 2019
Merged

Ensure $request->hasSession() is always checked before calling getSession() #32703

merged 1 commit into from
Jul 30, 2019

Conversation

Arman-Hosseini
Copy link
Contributor

@Arman-Hosseini Arman-Hosseini commented Jul 24, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jul 24, 2019

Any reason why you're proposing this?

@Arman-Hosseini
Copy link
Contributor Author

@nicolas-grekas
Just improving the codes.

@fabpot
Copy link
Member

fabpot commented Jul 27, 2019

We do not change code that works. We did such refactoring in the past and that introduced some bugs. So, we either refactor to fix a bug or we keep the current code.

@nicolas-grekas nicolas-grekas changed the base branch from 3.4 to 4.4 July 27, 2019 09:07
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

I rebased this PR for 4.4 and reviewed the full code base to ensure we don't call getSession without checking hasSession before, as it is required now (getSession throws in 5.0 instead of returning null)

@nicolas-grekas nicolas-grekas changed the title [Security] Update some of the codes in AuthenticationUtils Ensure $request->getSession() always checks hasSession() before Jul 27, 2019
@nicolas-grekas nicolas-grekas changed the title Ensure $request->getSession() always checks hasSession() before Ensure $request->hasSession() is always checked before calling getSession() Jul 27, 2019
@nicolas-grekas nicolas-grekas modified the milestones: 3.4, next Jul 27, 2019
@Arman-Hosseini
Copy link
Contributor Author

@nicolas-grekas thank you.

xabbuh
xabbuh previously requested changes Jul 27, 2019
Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

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

looks like some tests are failing

@chalasr
Copy link
Member

chalasr commented Jul 28, 2019

@xabbuh fixed, thanks

@nicolas-grekas nicolas-grekas dismissed xabbuh’s stale review July 28, 2019 17:50

tests are now fixed

@nicolas-grekas
Copy link
Member

Thank you @Arman-Hosseini.

@nicolas-grekas nicolas-grekas merged commit 7b2c326 into symfony:4.4 Jul 30, 2019
nicolas-grekas added a commit that referenced this pull request Jul 30, 2019
…ling getSession() (Arman-Hosseini)

This PR was merged into the 4.4 branch.

Discussion
----------

Ensure $request->hasSession() is always checked before calling getSession()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

7b2c326 Ensure $request->hasSession() is always checked before calling getSession()
@Arman-Hosseini Arman-Hosseini deleted the patch-6 branch July 30, 2019 16:01
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants