Problem/Motivation
So everything starts here where we clone a redirect response and replace the old response.
$safe_response = LocalRedirectResponse::createFromRedirectResponse($response);
$event->setResponse($safe_response);
::createFromRedirectResponse takes care to copy everything, including exporting headers and sending them over, sending the path, etc. Unfortunately, cookies are not included in the constructor and despite living in the header bag, don't get exported or imported in the copy process. This means a listener that runs earlier and sets a cookie has that cookie thrown away leading to table flipping and hair pulling.
Proposed resolution
Iterate over cookies and set them on the cloned response.
Remaining tasks
Agree and commit
User interface changes
N/A
API changes
N/A
Data model changes
N/A
RC phase evaluation
Issue category | Bug code doesn't not behave correctly. |
---|---|
Issue priority | Normal bug. Doesn't affect core behaviors but disruptions normal assumptions about code behavior. Cookies set on a response should always be sent. |
Allowed in RC | Contrib blocked. Bakery commonly sets its cookies why redirecting. |
Needed in RC | Blocking contrib migration and site builder |
No BC break, feature, etc. Just a bug. | |
Disruption: Fixes a bug, blocks a contributed project | No disruption, just restores expected behavior. |
Comment | File | Size | Author |
---|---|---|---|
#32 | 2582309-32.interdiff.txt | 889 bytes | neclimdul |
#32 | cookies_get_lost_during-2582309-32.patch | 3.28 KB | neclimdul |
#32 | cookies_get_lost_during-2582309-32-FAILURE.patch | 2.47 KB | neclimdul |
#28 | interdiff.2582309-28.txt | 2.4 KB | neclimdul |
#28 | cookies_get_lost_during-2582309-28.patch | 3.29 KB | neclimdul |
Comments
Comment #2
neclimdulDid my best in the summary but hopefully this makes it a little more clear.
Comment #3
neclimdulwhere'd the patch go d.o?
Comment #4
joelpittetCould use an automated test to ensure we don't run into this bug in the future.
Comment #6
dawehnerWow, is that something we could fix upstream?
Comment #7
neclimdulFair enough. There where some tests for methods using this base class but not the method itself so new unit test.
Exposed a bonus SymfonyWTF: https://github.com/symfony/symfony/issues/16171
Comment #8
neclimdulthis one was my fault...
Comment #11
neclimdulre #6, I don't think there is a need to fix it upstream. We have this method becase we are already copying other values in this way and its an architectural issue not a bug. Possibly an architecture we could look at improving in a future release of Symfony though.
Grumble grumble groups...
Comment #14
neclimdulThe patch that has the previous interdiff. I don't know what my problem is...
Comment #15
neclimdulSeriously? Since this was blocking my work on migrating Bakery, tagging as well.
Comment #17
neclimdulyeah, sorry pifr. you don't get to rule my issues anymore.
Comment #18
joelpittetThank you for adding tests! I agree, PIFR your reign is over.
Comment #19
tim.plunkettFixable on commit:
Extra space between * and {
return TRUE;
Comment #20
dawehnerCan we have a comment why we are doing this here?
Comment #21
neclimdulWhy not.
Comment #22
joelpittetThank you re-RTBC. Comments and docs addressed.
Comment #23
YesCT CreditAttribution: YesCT commented@joelpittet
https://www.drupal.org/core/d8-allowed-changes
says
I think we need a "beta evaluation" like thing in the issue summary which goes through the criteria in https://www.drupal.org/core/d8-allowed-changes
Comment #24
neclimdulIts my understanding the "Contributed project blocker" tag should have covered this. I'm very confused about what commiters what to see on issues right now.
Comment #25
neclimdulNot linked from the RC evaluation but googling I found the template. Hopefully this clarifies.
Comment #26
YesCT CreditAttribution: YesCT commentedComment #27
YesCT CreditAttribution: YesCT commentedComment #28
neclimdulre-roll around #2573923: Introduce a CacheableRedirectResponse and use it where appropriate
Comment #29
neclimdulCould use a look to make sure it looks right actually. Didn't mean to leave it RTBC.
Comment #30
joelpittetNot sure how this will play out, I'm sure if it doesn't get in for RC it can likely go into 8.0.1 or something, but there is a fancy RC evaluation in the IS now.
nit: remove the word 'arn't'
Comment #31
joelpittetWould you mind posting a tests only patch with the next patch?
Comment #32
neclimdulSure thing. Hopefully I got the upload order correct...
Comment #34
joelpittetThank you @neclimdul. I think this has all the right stuff now.
Comment #36
xjmDiscussed with the D8 committers and we agreed with making this an rc target.
Comment #37
webchickCommitted and pushed to 8.0.x. Thanks!
Comment #39
neclimdulMany thanks!