class LegacyPdoSessionHandler implements SessionHandlerInterface

deprecated since version 2.6, to be removed in 3.0. Use {@link PdoSessionHandler} instead.

Session handler using a PDO connection to read and write data.

Session data is a binary string that can contain non-printable characters like the null byte. For this reason this handler base64 encodes the data to be able to save it in a character column.

This version of the PdoSessionHandler does NOT implement locking. So concurrent requests to the same session can result in data loss due to race conditions.

Methods

__construct(PDO $pdo, array $dbOptions = array())

Constructor.

open($savePath, $sessionName)

{@inheritdoc}

close()

{@inheritdoc}

destroy($sessionId)

{@inheritdoc}

gc($maxlifetime)

{@inheritdoc}

read($sessionId)

{@inheritdoc}

write($sessionId, $data)

{@inheritdoc}

PDO
getConnection()

Return a PDO instance.

Details

at line 70
__construct(PDO $pdo, array $dbOptions = array())

Constructor.

List of available options: * db_table: The name of the table [required] * db_id_col: The column where to store the session id [default: sess_id] * db_data_col: The column where to store the session data [default: sess_data] * db_time_col: The column where to store the timestamp [default: sess_time]

Parameters

PDO $pdo A \PDO instance
array $dbOptions An associative array of DB options

Exceptions

InvalidArgumentException When "db_table" option is not provided

at line 95
open($savePath, $sessionName)

{@inheritdoc}

Parameters

$savePath
$sessionName

at line 103
close()

{@inheritdoc}

at line 111
destroy($sessionId)

{@inheritdoc}

Parameters

$sessionId

at line 130
gc($maxlifetime)

{@inheritdoc}

Parameters

$maxlifetime

at line 149
read($sessionId)

{@inheritdoc}

Parameters

$sessionId

at line 174
write($sessionId, $data)

{@inheritdoc}

Parameters

$sessionId
$data

at line 264
protected PDO getConnection()

Return a PDO instance.

Return Value

PDO