public function WriteSafeSessionHandler::write

public WriteSafeSessionHandler::write($session_id, $session_data)

Writes the session data to the storage.

Care, the session ID passed to write() can be different from the one previously received in read() when the session ID changed due to session_regenerate_id().

Parameters

string $sessionId Session ID , see http://php.net/function.session-id:

string $data Serialized session data to save:

Return value

bool true on success, false on failure

Overrides SessionHandlerInterface::write

See also

http://php.net/sessionhandlerinterface.write

File

core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php, line 73

Class

WriteSafeSessionHandler
Wraps another SessionHandlerInterface to prevent writes when not allowed.

Namespace

Drupal\Core\Session

Code

public function write($session_id, $session_data) {
  if ($this->isSessionWritable()) {
    return $this->wrappedSessionHandler->write($session_id, $session_data);
  }
  else {
    return TRUE;
  }
}

© 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!WriteSafeSessionHandler.php/function/WriteSafeSessionHandler::write/8.1.x