Horde_Session_Null
extends Horde_Session
in package
implements
Horde_Shutdown_Task
The null driver provides a set of methods for handling the administration and contents of the Horde session variable when the PHP session is not desired. Needed so things like application authentication can work within a single HTTP request when we don't need the overhead of a full PHP session.
Tags
Table of Contents
Interfaces
- Horde_Shutdown_Task
- Interface to enable a class to implement a shutdown task.
Constants
- BEGIN = '_b'
- DATA = '_d'
- ENCRYPT = 4
- ENCRYPTED = '_e'
- MODIFIED = '_m'
- NONCE_ID = 'session_nonce'
- NOT_SERIALIZED = "\x00"
- PRUNE = '_p'
- REGENERATE = '_r'
- TOKEN_ID = 'session_token'
- TYPE_ARRAY = 1
- TYPE_OBJECT = 2
Properties
- $begin : int
- $maxStore : int
- Maximum size of the pruneable data store.
- $regenerate_due : bool
- $regenerate_interval : int
- $session_data : array<string|int, mixed>
- $sessionHandler : Horde_SessionHandler
- The session handler object.
- $_active : bool
- Indicates that the session is active (read/write).
- $_cleansession : bool
- Indicate that a new session ID has been generated for this page load.
- $_data : array<string|int, mixed>
- Pointer to the session data.
- $_readonly : bool
- Indicates that session data is read-only.
- $_relogin : int
- On re-login, indicate whether we were previously authenticated.
Methods
- __construct() : mixed
- Constructor.
- __get() : mixed
- __set() : mixed
- checkNonce() : mixed
- Checks the validity of the session nonce.
- checkToken() : mixed
- Checks the validity of the session token.
- clean() : bool
- Destroys any existing session on login and make sure to use a new session ID, to avoid session fixation issues. Should be called before checking a login.
- close() : mixed
- Close the current session.
- destroy() : mixed
- Destroy session data.
- exists() : bool
- Does the session variable exist?
- get() : mixed
- Get the value of a session variable.
- getNonce() : string
- Returns a single-use, session nonce.
- getToken() : string
- Returns the session token.
- isActive() : bool
- Is the current session active (read/write)?
- purge() : mixed
- regenerate() : mixed
- Regenerate the session ID.
- remove() : mixed
- Remove session key(s).
- retrieve() : mixed
- set() : mixed
- Sets the value of a session variable.
- setup() : mixed
- Sets a custom session handler up, if there is one.
- shutdown() : mixed
- Shutdown tasks.
- start() : mixed
- Starts the session.
- store() : mixed
- _start() : mixed
- Tasks to perform when starting a session.
- _getKey() : string
- Generates the unique storage key.
- _subkeys() : array<string|int, mixed>
- Return the list of subkeys for a master key.
Constants
BEGIN
public
mixed
BEGIN
= '_b'
DATA
public
mixed
DATA
= '_d'
ENCRYPT
public
mixed
ENCRYPT
= 4
ENCRYPTED
public
mixed
ENCRYPTED
= '_e'
MODIFIED
public
mixed
MODIFIED
= '_m'
NONCE_ID
public
mixed
NONCE_ID
= 'session_nonce'
NOT_SERIALIZED
public
mixed
NOT_SERIALIZED
= "\x00"
PRUNE
public
mixed
PRUNE
= '_p'
REGENERATE
public
mixed
REGENERATE
= '_r'
TOKEN_ID
public
mixed
TOKEN_ID
= 'session_token'
TYPE_ARRAY
public
mixed
TYPE_ARRAY
= 1
TYPE_OBJECT
public
mixed
TYPE_OBJECT
= 2
Properties
$begin read-only
public
int
$begin
The timestamp when this session began (0 if session is not active).
$maxStore
Maximum size of the pruneable data store.
public
int
$maxStore
= 20
$regenerate_due read-only
public
bool
$regenerate_due
True if session ID is due for regeneration (since 2.5.0).
$regenerate_interval read-only
public
int
$regenerate_interval
The regeneration interval (since 2.5.0).
$session_data write-only
public
array<string|int, mixed>
$session_data
Manually set session data (since 2.5.0).
$sessionHandler
The session handler object.
public
Horde_SessionHandler
$sessionHandler
= \null
$_active
Indicates that the session is active (read/write).
protected
bool
$_active
= \false
$_cleansession
Indicate that a new session ID has been generated for this page load.
protected
bool
$_cleansession
= \false
$_data
Pointer to the session data.
protected
array<string|int, mixed>
$_data
$_readonly
Indicates that session data is read-only.
protected
bool
$_readonly
= \false
$_relogin
On re-login, indicate whether we were previously authenticated.
protected
int
$_relogin
= \null
Methods
__construct()
Constructor.
public
__construct() : mixed
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
checkNonce()
Checks the validity of the session nonce.
public
checkNonce(string $nonce) : mixed
Parameters
- $nonce : string
-
Nonce to check.
Tags
checkToken()
Checks the validity of the session token.
public
checkToken(string $token) : mixed
Parameters
- $token : string
-
Token to check.
Tags
clean()
Destroys any existing session on login and make sure to use a new session ID, to avoid session fixation issues. Should be called before checking a login.
public
clean() : bool
Return values
bool —True if the session was cleaned.
close()
Close the current session.
public
close() : mixed
destroy()
Destroy session data.
public
destroy() : mixed
exists()
Does the session variable exist?
public
exists(string $app, string $name) : bool
Parameters
- $app : string
-
Application name.
- $name : string
-
Session variable name.
Return values
bool —True if session variable exists.
get()
Get the value of a session variable.
public
get(string $app, string $name[, int $mask = 0 ]) : mixed
Parameters
- $app : string
-
Application name.
- $name : string
-
Session variable name.
- $mask : int = 0
-
One of:
- Horde_Session::TYPE_ARRAY - Return an array value.
- Horde_Session::TYPE_OBJECT - Return an object value.
Return values
mixed —The value or null if the value doesn't exist.
getNonce()
Returns a single-use, session nonce.
public
getNonce() : string
Tags
Return values
string —Session nonce.
getToken()
Returns the session token.
public
getToken() : string
Return values
string —Session token.
isActive()
Is the current session active (read/write)?
public
isActive() : bool
Return values
bool —True if the current session is active.
purge()
public
purge(mixed $id) : mixed
Use Horde_Core_Cache_SessionObjects instead.
Parameters
- $id : mixed
regenerate()
Regenerate the session ID.
public
regenerate() : mixed
Tags
remove()
Remove session key(s).
public
remove(string $app[, string $name = null ]) : mixed
Parameters
- $app : string
-
Application name.
- $name : string = null
-
Session variable name.
retrieve()
public
retrieve(mixed $id) : mixed
Use Horde_Core_Cache_SessionObjects instead.
Parameters
- $id : mixed
set()
Sets the value of a session variable.
public
set(string $app, string $name, mixed $value[, int $mask = 0 ]) : mixed
Parameters
- $app : string
-
Application name.
- $name : string
-
Session variable name.
- $value : mixed
-
Session variable value.
- $mask : int = 0
-
One of:
- Horde_Session::TYPE_ARRAY: Force save as an array value.
- Horde_Session::TYPE_OBJECT: Force save as an object value.
- Horde_Session::ENCRYPT: Encrypt the value. (since 2.7.0)
setup()
Sets a custom session handler up, if there is one.
public
setup([mixed $start = true ][, mixed $cache_limiter = null ][, mixed $session_id = null ]) : mixed
Parameters
- $start : mixed = true
-
Initiate the session?
- $cache_limiter : mixed = null
-
Override for the session cache limiter value.
- $session_id : mixed = null
-
The session ID to use.
shutdown()
Shutdown tasks.
public
shutdown() : mixed
start()
Starts the session.
public
start() : mixed
store()
public
store(mixed $data[, mixed $prune = true ][, mixed $id = null ]) : mixed
Use Horde_Core_Cache_SessionObjects instead.
Parameters
- $data : mixed
- $prune : mixed = true
- $id : mixed = null
_start()
Tasks to perform when starting a session.
protected
_start() : mixed
_getKey()
Generates the unique storage key.
private
_getKey(string $app, string $name) : string
Parameters
- $app : string
-
Application name.
- $name : string
-
Session variable name.
Return values
string —The unique storage key.
_subkeys()
Return the list of subkeys for a master key.
private
_subkeys(string $app, string $name) : array<string|int, mixed>
Parameters
- $app : string
-
Application name.
- $name : string
-
Session variable name.
Return values
array<string|int, mixed> —Subkeyname (keys) and session variable name (values).