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

[WebProfilerBundle] fixed getSession when no session has been set deprecation warnings#27458

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

Merged
nicolas-grekas merged 1 commit intosymfony:4.1fromGregOriol:master
Jun 4, 2018

Conversation

@GregOriol
Copy link
Contributor

@GregOriolGregOriol commentedMay 31, 2018
edited
Loading

QA
Branch?4.1
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsnone but see comment
LicenseMIT

Symfony 4.1 adds deprecation warnings when getSession is called and a session has not been set.
Some code in the WebProfiler was not up-to-date to use hasSession before.

(this actually causedSilex-WebProfiler's tests to fail)

alcalyn reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneJun 1, 2018
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

minor CS comment (we don't use brackets usually when not needed, like here)

}

if (null ===$session =$request->getSession()) {
if (!$request->hasSession() ||null ===($session =$request->getSession())) {

Choose a reason for hiding this comment

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

I'd suggest to useif (!$request->hasSession() || !$session = $request->getSession()) {

$token =$request->query->get('token');

if (null !==$session =$request->getSession()) {
if ($request->hasSession() && ($session =$request->getSession())) {

Choose a reason for hiding this comment

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

if ($request->hasSession() && $session = $request->getSession()) {


{%macro profile_search_filter(request,result,property) %}
{%-ifrequest.sessionis notnull -%}
{%-ifrequest.hasSessionandrequest.sessionis notnull -%}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not only{%- if request.hasSession -%} ?

GregOriol reacted with thumbs up emoji
}

if (null ===$session =$request->getSession()) {
if (!$request->hasSession() || !$session =$request->getSession()) {
Copy link
Member

Choose a reason for hiding this comment

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

if (!$request->hasSession()) is enough

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Are you sure? I think we need $session in the else part.
We could move$session = $request->getSession() into the else though.

Copy link
Member

Choose a reason for hiding this comment

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

moving it to theelse seems reasonable to me

@nicolas-grekasnicolas-grekas changed the base branch frommaster to4.1June 4, 2018 20:59
@nicolas-grekas
Copy link
Member

Thank you@GregOriol.

@nicolas-grekasnicolas-grekas merged commit0f3ba5a intosymfony:4.1Jun 4, 2018
nicolas-grekas added a commit that referenced this pull requestJun 4, 2018
…een set deprecation warnings (GregOriol)This PR was submitted for the master branch but it was squashed and merged into the 4.1 branch instead (closes#27458).Discussion----------[WebProfilerBundle] fixed getSession when no session has been set deprecation warnings| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | none but see comment| License       | MITSymfony 4.1 adds deprecation warnings when getSession is called and a session has not been set.Some code in the WebProfiler was not up-to-date to use hasSession before.(this actually caused [Silex-WebProfiler](https://github.com/silexphp/Silex-WebProfiler)'s tests to fail)Commits-------0f3ba5a [WebProfilerBundle] fixed getSession when no session has been set deprecation warnings
@fabpotfabpot mentioned this pull requestJun 25, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@alcalynalcalynalcalyn approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

6 participants

@GregOriol@nicolas-grekas@javiereguiluz@alcalyn@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp