method __construct documentation in bbn\User\Session
function(array $defaults = NULL)
{
if (self::singletonExists()) {
throw new Exception("Impossible to create a new session, one already exists");
}
/*
if (defined('BBN_DATA_PATH') && !$this->isOpened()) {
session_save_path(BBN_DATA_PATH.'sessions');
}
*/
self::singletonInit($this);
if ($id = session_id()) {
$this->was_opened = true;
$this->once_opened = true;
}
else {
$this->open();
$id = session_id();
}
if (!$id) {
$save_path = session_save_path();
if (!is_dir($save_path)) {
throw new Exception(X::_("The session path %s doesn't exist", $save_path));
}
elseif (!is_writable($save_path)) {
throw new Exception(X::_("The session path %s is not writable", $save_path));
}
else {
throw new Exception(X::_("Impossible to retrieve the session's ID"));
}
}
$this->id = $id;
if (!isset($_SESSION[self::$name])) {
$_SESSION[self::$name] = \is_array($defaults) ? $defaults : [];
}
$this->data = $_SESSION[self::$name];
$this->close();
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions