Skip to content
Merged
Changes from all 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
9 changes: 8 additions & 1 deletion src/Illuminate/Session/Middleware/StartSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class StartSession implements MiddlewareContract, TerminableMiddleware {
*/
protected $manager;

/**
* True if handle method called
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing fullstop and the description is rubbish

* @var bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

need an extra line of comment here

*/
protected $sessionHandled = false;

/**
* Create a new session middleware.
*
Expand All @@ -40,6 +46,7 @@ public function __construct(SessionManager $manager)
*/
public function handle($request, Closure $next)
{
$this->sessionHandled = true;
// If a session driver has been configured, we will need to start the session here
// so that the data is ready for an application. Note that the Laravel sessions
// do not make use of PHP "native" sessions in any way since they are crappy.
Expand Down Expand Up @@ -76,7 +83,7 @@ public function handle($request, Closure $next)
*/
public function terminate($request, $response)
{
if ($this->sessionConfigured() && ! $this->usingCookieSessions())
if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions())
{
$this->manager->driver()->save();
}
Expand Down