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

[HttpFoundation] deprecate call to Request::getSession() when Request::hasSession() returns false#26564

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
fabpot merged 1 commit intosymfony:masterfromfmata:issue-26539
Mar 18, 2018

Conversation

@fmata
Copy link
Contributor

@fmatafmata commentedMar 16, 2018
edited by nicolas-grekas
Loading

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#26539
LicenseMIT

sstok and soullivaneuh reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas changed the title[HttpFoundation] deprecate call to Request::getSession() when Request…[HttpFoundation] deprecate call to Request::getSession() when Request::hasSession() returns falseMar 16, 2018
}

if (null ===$session) {
@trigger_error(sprintf('Calling "%s()" when "%s::hasSession()" returns false is deprecated since Symfony 4.1 and will throw an exception in 5.0.',__METHOD__,__CLASS__),E_USER_DEPRECATED);

Choose a reason for hiding this comment

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

Calling "%s()" when non session has been set is deprecated since Symfony 4.1 and will throw an exception in 5.0. Use "hasSession()" instead.

also, please add the exception tight now, but as a commented line, so that upgrading for 5.0 is made trivial:
// throw new ...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Message updated.

About the// throw new ... I thought a type hinting on the return type withSessionInterface was enough, PHP will throw :

TypeError : Return value of Request::getSession() must implement interface SessionInterface.

WDYT ?

Choose a reason for hiding this comment

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

I think we can provide a friendlier message, don't you?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated

}

if (null ===$session) {
@trigger_error(sprintf('Calling "%s()" when non session has been set is deprecated since Symfony 4.1 and will throw an exception in 5.0. Use "hasSession()" instead.',__METHOD__),E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: no session

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed


* The `$size` argument of the `UploadedFile` constructor has been removed.
* The `getClientSize()` method of the `UploadedFile` class has been removed.
* The `getSession()` method of the `Request` class throws an exception when session is null.
Copy link
Contributor

Choose a reason for hiding this comment

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

mentioning the deprecation in UPGRADE-4.1.md and HttpFoundation/CHANGELOG.md is missing

Copy link
ContributorAuthor

@fmatafmataMar 17, 2018
edited
Loading

Choose a reason for hiding this comment

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

Done. I will send a PR (edit :#26580) to update the Github PR template to help contributors to do such things, thanks.

@fabpot
Copy link
Member

Thank you@fmata.

@fabpotfabpot merged commit4110d57 intosymfony:masterMar 18, 2018
fabpot added a commit that referenced this pull requestMar 18, 2018
…() when Request::hasSession() returns false (fmata)This PR was merged into the 4.1-dev branch.Discussion----------[HttpFoundation] deprecate call to Request::getSession() when Request::hasSession() returns false| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#26539| License       | MITCommits-------4110d57 [HttpFoundation] deprecate call to Request::getSession() when Request::hasSession() returns false
@fabpotfabpot mentioned this pull requestMay 7, 2018
nicolas-grekas added a commit that referenced this pull requestMay 25, 2018
…r (alekitto)This PR was merged into the 4.1 branch.Discussion----------[HttpKernel] fix deprecation in AbstractTestSessionListener| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| License       | MITAfter#26564 functional tests began to emit a deprecation warning because of `getSession()` being called without verifying the existence of a session.Commits-------0ecaefe [HttpKernel] fix deprecation in AbstractTestSessionListener
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+1 more reviewer

@TobionTobionTobion left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@fmata@fabpot@nicolas-grekas@Tobion@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp