Skip to content

Updated references to new Session() #3769

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

Closed
wants to merge 9 commits into from
Closed
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions components/http_foundation/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ object-oriented interface using a variety of session storage drivers.
Sessions are used via the simple :class:`Symfony\\Component\\HttpFoundation\\Session\\Session`
implementation of :class:`Symfony\\Component\\HttpFoundation\\Session\\SessionInterface` interface.

.. caution::

Make sure your sessions aren't already initialized (which is, for example,
automatically done in the full-stack framework). As initializing the
Session object causes the session to be started, which can lead to unexpected
errors.
Copy link
Member

Choose a reason for hiding this comment

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

Is the comment about the full-stack framework adding anything here? I think it might be confusing what we're saying. As I understand it, the important message here is "make sure the PHP session hasn't already been started in some other way before using the Session object, else you'll get an error". Can we remove the full-stack framework comment to add clarity?

And if I'm understanding the message correctly, I think we can say it in one really quick sentence:

Make sure your PHP session isn't already started before using the Session class. If you have a legacy session system that starts your session, see [link to http://symfony.com/doc/current/components/http_foundation/session_php_bridge.html]


Quick example::

use Symfony\Component\HttpFoundation\Session\Session;
Expand Down