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] Support samesite cookies in response#26478

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
lstrojny wants to merge2 commits intosymfony:3.4fromlstrojny:dev/cookie-samesite-support
Closed

[HttpFoundation] Support samesite cookies in response#26478

lstrojny wants to merge2 commits intosymfony:3.4fromlstrojny:dev/cookie-samesite-support

Conversation

@lstrojny
Copy link
Contributor

@lstrojnylstrojny commentedMar 10, 2018
edited by nicolas-grekas
Loading

QA
Branch?3.4
Bug fix?yes
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25344
LicenseMIT
Doc PRn.A.

This hack adds support for samesite cookies inResponse::sendHeaders(). One can misuse the path parameter to set the samesite attribute nevertheless.

@staabm
Copy link
Contributor

They might kill your hack in the next php version
php/php-src#3179

sstok reacted with laugh emoji

@cmb69
Copy link

They might kill your hack in the next php version

Note that the PR targets PHP-7.1, since it is supposed to fix a bug.

@staabm
Copy link
Contributor

Maybe you could use or take some inspiration fromhttps://github.com/delight-im/PHP-Cookie

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneMar 12, 2018
@nicolas-grekas
Copy link
Member

The hack might be acceptable if it is tested.

@lstrojny
Copy link
ContributorAuthor

@nicolas-grekas the best idea I could come up with for a test is an integration test that starts the built-in PHP server and verifies that the header is as expected.


// cookies
foreach ($this->headers->getCookies()as$cookie) {
$path =$cookie->getPath().(null !==$cookie->getSameSite() ? ('; samesite='.$cookie->getSameSite()) :'');

Choose a reason for hiding this comment

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

I understand that this is a hack needed because of the lack of support ofsamesite in PHP cookie functions. However, wouldn't it be better to hack this into$cookie->getDomain() instead of$cookie->getPath() ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@javiereguiluz the issue is, domain can be null while path will always be something

Choose a reason for hiding this comment

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

OK then 👍 ... but@nicolas-grekas proposal may be a better way to solve this? What do you think?

@nicolas-grekasnicolas-grekas changed the titleSupport samesite cookies in response[HttpFoundation] Support samesite cookies in responseMar 16, 2018
@nicolas-grekas
Copy link
Member

Actually here is another approach I worked on, the discussion might still be relevant:#25348

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedApr 9, 2018
edited
Loading

Closing in favor of#25348, thank you@lstrojny

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@lstrojny@staabm@cmb69@nicolas-grekas@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp