Skip to content
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

Info about implicit session start #5664

Closed
wants to merge 2 commits into from

Conversation

ThomasLandauer
Copy link
Contributor

This should be explained somewhere (took me a while to figure it out). If this is not the right place (or format), please go ahead and correct it!

This should be explained *somewhere* (took me a while to figure it out). If this is not the right place (or format), please go ahead and correct it!
@xabbuh
Copy link
Member

xabbuh commented Sep 1, 2015

I think it's a good idea to explain it here. Though I would rather put it in a caution block to make it more visible:

.. caution::
    Since the token is stored [...]

@ThomasLandauer
Copy link
Contributor Author

OK, sure! Would you help me?
I don't have that much knowledge, just wanted to raise the attention of somebody to this issue. There are several related questions on Stackoverflow, e.g. http://stackoverflow.com/questions/26778786/symfony2-failed-to-start-the-session-already-started-by-php/
but the interplay between session and forms is documented nowhere.

On http://symfony.com/doc/current/components/http_foundation/sessions.html it says: "While it is recommended to explicitly start a session,...", this didn't work for me when using a form. So the open questions are:

  • What's the exact benefit of starting a session explicitly?
  • Do forms use Symfony's sessions or PHP's native sessions?
  • How can you see the CSRF token in the session? Should probably be in the Attributes Bag, but I can't see it there.
    And a code example of the recommended way to do it would really be nice!

Cheers,
Thomas

@xabbuh
Copy link
Member

xabbuh commented Sep 2, 2015

Oh, it's quite easy. Just replace the paragraph you added with the following markup:

.. caution::

    Since the token is stored in the session, a session is started automatically
    as soon as you render a form with CSRF protection.

That's it. :)

@xabbuh: Please write some additional details about my questions above - I don't know the answers ;-)
@xabbuh
Copy link
Member

xabbuh commented Sep 5, 2015

👍

@xabbuh
Copy link
Member

xabbuh commented Oct 9, 2015

Thank you Thomas.

xabbuh added a commit that referenced this pull request Oct 9, 2015
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #5664).

Discussion
----------

Info about implicit session start

This should be explained *somewhere* (took me a while to figure it out). If this is not the right place (or format), please go ahead and correct it!

Commits
-------

662bb01 Info about implicit session start
@xabbuh xabbuh closed this Oct 9, 2015
@ThomasLandauer ThomasLandauer deleted the patch-2 branch August 17, 2018 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants