Skip to content

Commit 490efdc

Browse files
author
scottwarren
committed
Updated references to new Session()
If you use new Session(), you get a 500 error, with the following message: ```log Failed to start the session: already started by PHP. ```
1 parent 1172b7d commit 490efdc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/http_foundation/sessions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Quick example::
1616

1717
use Symfony\Component\HttpFoundation\Session\Session;
1818

19-
$session = new Session();
19+
$session = $this->getRequest()->getSession();
2020
$session->start();
2121

2222
// set and get session attributes
@@ -291,7 +291,7 @@ Examples of setting multiple flashes::
291291

292292
use Symfony\Component\HttpFoundation\Session\Session;
293293

294-
$session = new Session();
294+
$session = $this->getRequest()->getSession();
295295
$session->start();
296296

297297
// add flash messages

0 commit comments

Comments
 (0)