Documentation

FileHandler extends BaseHandler
in package

Session handler using file system for storage

Table of Contents

$cookieDomain  : string
Cookie domain
$cookieName  : string
Cookie name to use
$cookiePath  : string
Cookie path
$cookiePrefix  : string
Cookie prefix
$cookieSecure  : bool
Cookie secure?
$fileHandle  : resource|null
The file handle
$fileNew  : bool
Whether this is a new file.
$filePath  : string
File Name
$fingerprint  : string
The Data fingerprint.
$ipAddress  : string
User's IP address.
$lock  : mixed
Lock placeholder.
$logger  : LoggerInterface|null
The logger instance.
$matchIP  : bool
Whether IP addresses should be matched.
$savePath  : string
Where to save the session files to.
$sessionID  : string
Current session ID
$sessionIDRegex  : string
Regex of session ID
__construct()  : mixed
Constructor
close()  : bool
Close
destroy()  : bool
Destroy
gc()  : bool
Garbage Collector
open()  : bool
Open
read()  : string|bool
Read
setLogger()  : mixed
Sets a logger.
write()  : bool
Write
configureSessionIDRegex()  : mixed
Configure Session ID regular expression
destroyCookie()  : bool
Internal method to force removal of a cookie by the client when session_destroy() is called.
fail()  : bool
Fail
lockSession()  : bool
A dummy method allowing drivers with no locking functionality (databases other than PostgreSQL and MySQL) to act as if they do acquire a lock.
releaseLock()  : bool
Releases the lock, if any.

Properties

$cookieDomain

Cookie domain

protected string $cookieDomain = ''

$cookieName

Cookie name to use

protected string $cookieName

$cookiePath

Cookie path

protected string $cookiePath = '/'

$cookiePrefix

Cookie prefix

protected string $cookiePrefix = ''

$cookieSecure

Cookie secure?

protected bool $cookieSecure = false

$fileHandle

The file handle

protected resource|null $fileHandle

$fileNew

Whether this is a new file.

protected bool $fileNew

$fingerprint

The Data fingerprint.

protected string $fingerprint

$ipAddress

User's IP address.

protected string $ipAddress

$lock

Lock placeholder.

protected mixed $lock = false

$matchIP

Whether IP addresses should be matched.

protected bool $matchIP = false

$savePath

Where to save the session files to.

protected string $savePath

$sessionID

Current session ID

protected string $sessionID

$sessionIDRegex

Regex of session ID

protected string $sessionIDRegex = ''

Methods

__construct()

Constructor

public __construct(App $config, string $ipAddress) : mixed
Parameters
$config : App
$ipAddress : string
Return values
mixed

close()

Close

public close() : bool

Releases locks and closes file descriptor.

Return values
bool

destroy()

Destroy

public destroy(string $sessionId) : bool

Destroys the current session.

Parameters
$sessionId : string

Session ID

Return values
bool

gc()

Garbage Collector

public gc(int $maxlifetime) : bool

Deletes expired sessions

Parameters
$maxlifetime : int

Maximum lifetime of sessions

Return values
bool

open()

Open

public open(string $savePath, string $name) : bool

Sanitizes the save_path directory.

Parameters
$savePath : string

Path to session files' directory

$name : string

Session cookie name

Tags
throws
Exception
Return values
bool

read()

Read

public read(string $sessionID) : string|bool

Reads session data and acquires a lock

Parameters
$sessionID : string

Session ID

Return values
string|bool

Serialized session data

write()

Write

public write(string $sessionID, string $sessionData) : bool

Writes (create / update) session data

Parameters
$sessionID : string

Session ID

$sessionData : string

Serialized session data

Return values
bool

configureSessionIDRegex()

Configure Session ID regular expression

protected configureSessionIDRegex() : mixed
Return values
mixed

destroyCookie()

Internal method to force removal of a cookie by the client when session_destroy() is called.

protected destroyCookie() : bool
Return values
bool

fail()

Fail

protected fail() : bool

Drivers other than the 'files' one don't (need to) use the session.save_path INI setting, but that leads to confusing error messages emitted by PHP when open() or write() fail, as the message contains session.save_path ... To work around the problem, the drivers will call this method so that the INI is set just in time for the error message to be properly generated.

Return values
bool

lockSession()

A dummy method allowing drivers with no locking functionality (databases other than PostgreSQL and MySQL) to act as if they do acquire a lock.

protected lockSession(string $sessionID) : bool
Parameters
$sessionID : string
Return values
bool

releaseLock()

Releases the lock, if any.

protected releaseLock() : bool
Return values
bool

Search results