public SessionManager::save()
Force the session to be saved and closed.
This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it should actually persist the session data if required.
\RuntimeException If the session is saved without being started, or if the session is already closed.
Overrides NativeSessionStorage::save
public function save() { if ($this->isCli()) { // We don't have anything to do if we are not allowed to save the session. return; } if ($this->isSessionObsolete()) { // There is no session data to store, destroy the session if it was // previously started. if ($this->getSaveHandler()->isActive()) { $this->destroy(); } } else { // There is session data to store. Start the session if it is not already // started. if (!$this->getSaveHandler()->isActive()) { $this->startNow(); } // Write the session data. parent::save(); } $this->startedLazy = FALSE; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Session!SessionManager.php/function/SessionManager::save/8.1.x