Skip to content

Fixed the handling of flash messages #863

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
Oct 4, 2018
Merged

Fixed the handling of flash messages #863

merged 1 commit into from
Oct 4, 2018

Conversation

javiereguiluz
Copy link
Member

Fixes the #859 merge.

@javiereguiluz javiereguiluz merged commit e6349dc into symfony:master Oct 4, 2018
javiereguiluz added a commit that referenced this pull request Oct 4, 2018
This PR was merged into the master branch.

Discussion
----------

Fixed the handling of flash messages

Fixes the #859 merge.

Commits
-------

e6349dc Fixed the handling of flash messages
@xabbuh
Copy link
Member

xabbuh commented Oct 10, 2018

I do not understand this change. I mean the flash entries will probably be created when processing a POST request, but the reason we register them is that we redirect at the end and we need to display them in response for the subsequent event which will be a GET request then. So with this change the flash messages are likely to never be shown.

@sebastianblum
Copy link

sebastianblum commented Oct 10, 2018

Hello @javiereguiluz and @xabbuh

This fix does only work with 307 redirects, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307

Submit form: POST /url - store flash message and redirect with 307 to /thank-you
307 redirect: POST /thank-you - shows the flash message

With an 302 redirect, the redirect will switch to an GET-Request and so the flash message will be hidden.
Submit form: POST /url - store flash message and redirect with 302 to /thank-you
302 redirect: GET /thank-you - doesn't show the flash message

But with the 307 request, the post body will be resend. That looks wrong to me.

@stof
Copy link
Member

stof commented Oct 10, 2018

Posting to a thank-you page looks wrong to me btw (that page should probably not even accept POST requests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants