Skip to content

Commit

Permalink
Issue #3045349 by alexpott, mikelutz, geerlingguy, catch, mglaman, la…
Browse files Browse the repository at this point in the history
…rowlan: Lazy started sessions with session data are not saved with symfony/http-foundation 3.4.24
  • Loading branch information
catch committed May 1, 2019
1 parent 90a748f commit fa55e1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"symfony/console": "~3.4.0",
"symfony/dependency-injection": "~3.4.26",
"symfony/event-dispatcher": "~3.4.0",
"symfony/http-foundation": "~3.4.26",
"symfony/http-foundation": "~3.4.27",
"symfony/http-kernel": "~3.4.14",
"symfony/routing": "~3.4.0",
"symfony/serializer": "~3.4.0",
Expand Down
19 changes: 1 addition & 18 deletions core/lib/Drupal/Core/Session/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ public function regenerate($destroy = FALSE, $lifetime = NULL) {
throw new \InvalidArgumentException('The optional parameters $destroy and $lifetime of SessionManager::regenerate() are not supported currently');
}

// Only migrate the session if the session is really started and not only
// lazy started.
if ($this->started) {
if ($this->isStarted()) {
$old_session_id = $this->getId();
// Save and close the old session. Call the parent method to avoid issue
// with session destruction due to the session being considered obsolete.
Expand Down Expand Up @@ -342,19 +340,4 @@ protected function migrateStoredSession($old_session_id) {
->execute();
}

/**
* Checks if the session is started.
*
* Beginning with symfony/http-foundation 3.4.24, the session will no longer
* save unless this method returns true. The parent method returns true if
* $this->started is true, but we need the session to also save if we lazy
* started, so we override isStarted() here.
*
* @return bool
* True if started, false otherwise
*/
public function isStarted() {
return parent::isStarted() || $this->startedLazy;
}

}

0 comments on commit fa55e1d

Please sign in to comment.