Session storage in $_SESSION

Replaces the $_SESSION superglobal with an ArrayObject that allows for property access, metadata storage, locking, and immutability.

 Methods

Constructor

__construct(array | null $input, int $flags, string $iteratorClass) 

Sets the $_SESSION superglobal to an ArrayObject, maintaining previous values if any discovered.

Parameters

$input

arraynull

$flags

int

$iteratorClass

string

Destructor

__destruct() : void

Resets $_SESSION superglobal to an array, by casting object using getArrayCopy().

Clear the storage object or a subkey of the object

clear(null | int | string $key) : \Zend\Session\Storage\ArrayStorage
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::clear()

Parameters

$key

nullintstring

Exceptions

\Zend\Session\Exception\RuntimeException

Returns

Load session object from an existing array

fromArray(array $array) : \Zend\Session\Storage\SessionStorage

Ensures $_SESSION is set to an instance of the object when complete.

Parameters

$array

array

Returns

Retrieve the request access time

getRequestAccessTime() : float
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::getRequestAccessTime()

Returns

float

Determine if this object is isImmutable

isImmutable() : bool

Returns

bool

Is the object or key marked as locked?

isLocked(null | int | string $key) : bool
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::isLocked()

Parameters

$key

nullintstring

Returns

bool

Lock this storage instance, or a key within it

lock(null | int | string $key) : \Zend\Session\Storage\ArrayStorage
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::lock()

Parameters

$key

nullintstring

Returns

Mark object as isImmutable

markImmutable() : \Zend\Session\Storage\SessionStorage

offsetSet()

offsetSet(mixed $key, mixed $value) 
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::offsetSet()

Parameters

$key

mixed

$value

mixed

Exceptions

\Zend\Session\Exception\RuntimeException

Cast the object to an array

toArray(bool $metaData) : array
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::toArray()

Parameters

$metaData

bool

Whether to include metadata

Returns

array

Unlock an object or key marked as locked

unlock(null | int | string $key) : \Zend\Session\Storage\ArrayStorage
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::unlock()

Parameters

$key

nullintstring

Returns

Set the request access time

setRequestAccessTime(float $time) : \Zend\Session\Storage\ArrayStorage
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::setRequestAccessTime()

Parameters

$time

float

Returns

 Properties

 

Is storage marked isImmutable?

$isImmutable : bool
Inherited

inherited_from \Zend\Session\Storage\ArrayStorage::$$isImmutable