/** * @param array $config */ public function __construct(array $config = []) { // make sure we've got all config elements for this driver $config['native'] = array_merge($this->defaults, isset($config['native']) ? $config['native'] : array()); // call the parent to process the global config parent::__construct($config); // get default the cookie params $params = session_get_cookie_params(); // update them with any config passed if (isset($config['cookie_domain'])) { $params['domain'] = $config['cookie_domain']; } if (isset($config['cookie_path'])) { $params['path'] = $config['cookie_path']; } if (isset($config['cookie_secure']) and $config['cookie_secure']) { $params['secure'] = true; } if (isset($config['cookie_http_only']) and $config['cookie_http_only']) { $params['httponly'] = true; } if (isset($config['expire_on_close']) and $config['expire_on_close']) { $params['lifetime'] = 0; } session_set_cookie_params($this->expiration, $params['path'], $params['domain'], $params['secure'], $params['httponly']); // store the defined name if (isset($config['native']['cookie_name'])) { $this->name = $config['native']['cookie_name']; } }
/** * @param array $config */ public function __construct(array $config = []) { // make sure we've got all config elements for this driver $config['cookie'] = array_merge($this->defaults, isset($config['cookie']) ? $config['cookie'] : array()); // call the parent to process the global config parent::__construct($config); // store the defined name if (isset($config['cookie']['cookie_name'])) { $this->name = $config['cookie']['cookie_name']; } }
/** * @param array $config */ public function __construct(array $config = []) { // make sure we've got all config elements for this driver $config['file'] = array_merge($this->defaults, isset($config['file']) ? $config['file'] : []); // validate the path if (!($path = realpath($config['file']['path']))) { throw new \Exception('Configured session storage directory\\ "' . $this->config['file']['path'] . " is not accessable."); } $config['file']['path'] = $path . DIRECTORY_SEPARATOR; // call the parent to process the global config parent::__construct($config); // store the defined name if (isset($config['file']['cookie_name'])) { $this->name = $config['file']['cookie_name']; } }