Zend_Session

category Zend
package Zend_Session
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Session_Abstract

 Methods

destroy() - This is used to destroy session data, and optionally, the session cookie itself

destroy(boolean $remove_cookie = true, boolean $readonly = true) : void
Static

Parameters

$remove_cookie

boolean
  • OPTIONAL remove session id cookie, defaults to true (remove cookie)

$readonly

boolean
  • OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)

expireSessionCookie() - Sends an expired session id cookie, causing the client to delete the session cookie

expireSessionCookie() : void
Static

forgetMe() - Write a volatile session cookie, removing any persistent cookie that may have existed. The session would end upon, for example, termination of a web browser program.

forgetMe() : void
Static

getId() - get the current session id

getId() : string
Static

Returns

string

getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface

getIterator() : \ArrayObject
Static

Exceptions

\Zend_Session_Exception

Returns

\ArrayObject

getOptions()

getOptions(string $optionName = null) : array | string
Static

Parameters

$optionName

string

OPTIONAL

Returns

arraystring

getSaveHandler() - Get the session Save Handler

getSaveHandler() : \Zend_Session_SaveHandler_Interface
Static

Returns

\Zend_Session_SaveHandler_Interface

Whether or not session has been destroyed via session_destroy()

isDestroyed() : boolean
Static

Returns

boolean

isReadable() - returns a boolean indicating if namespaces can write (use setters)

isReadable() : boolean
Static

Returns

boolean

isRegenerated() - convenience method to determine if session_regenerate_id() has been called during this request by Zend_Session.

isRegenerated() : boolean
Static

Returns

boolean

isStarted() - convenience method to determine if the session is already started.

isStarted() : boolean
Static

Returns

boolean

isWritable() - returns a boolean indicating if namespaces can write (use setters)

isWritable() : boolean
Static

Returns

boolean

namespaceGet() - get all variables in a namespace Deprecated: Use getIterator() in Zend_Session_Namespace.

namespaceGet(string $namespace) : array
Static

Parameters

$namespace

string

Returns

array

namespaceIsset() - check to see if a namespace is set

namespaceIsset(string $namespace) : boolean
Static

Parameters

$namespace

string

Returns

boolean

namespaceUnset() - unset a namespace or a variable within a namespace

namespaceUnset(string $namespace) : void
Static

Parameters

$namespace

string

Exceptions

\Zend_Session_Exception

regenerateId() - Regenerate the session id. Best practice is to call this after session is started. If called prior to session starting, session id will be regenerated at start time.

regenerateId() : void
Static

Exceptions

\Zend_Session_Exception

registerValidator() - register a validator that will attempt to validate this session for every future request

registerValidator(\Zend_Session_Validator_Interface $validator) : void
Static

Parameters

$validator

\Zend_Session_Validator_Interface

rememberMe() - Write a persistent cookie that expires after a number of seconds in the future. If no number of seconds is specified, then this defaults to self::$_rememberMeSeconds. Due to clock errors on end users' systems, large values are recommended to avoid undesirable expiration of session cookies.

rememberMe(integer $seconds = null) : void
Static

Parameters

$seconds

integer

OPTIONAL specifies TTL for cookie in seconds from present time

rememberUntil() - This method does the work of changing the state of the session cookie and making sure that it gets resent to the browser via regenerateId()

rememberUntil(integer $seconds = 0) : void
Static

Parameters

$seconds

integer

sessionExists() - whether or not a session exists for the current request

sessionExists() : boolean
Static

Returns

boolean

setId() - set an id to a user specified id

setId(string $id) : void
Static

Parameters

$id

string

Exceptions

\Zend_Session_Exception

setOptions - set both the class specified

setOptions(array $userOptions = array()) : void
Static

Parameters

$userOptions

array
  • pass-by-keyword style array of

Exceptions

\Zend_Session_Exception

setSaveHandler() - Session Save Handler assignment

setSaveHandler(\Zend_Session_SaveHandler_Interface $saveHandler) : void
Static

Parameters

$saveHandler

Exceptions

\Zend_Session_Exception When the session_set_save_handler call fails

start() - Start the session.

start(boolean|array $options = false) : void
Static

Parameters

$options

booleanarray

OPTIONAL Either user supplied options, or flag indicating if start initiated automatically

Exceptions

\Zend_Session_Exception

stop() - Disable write access. Optionally disable read (not implemented).

stop() : void
Static

writeClose() - Shutdown the sesssion, close writing and detach $_SESSION from the back-end storage mechanism.

writeClose(boolean $readonly = true) : void
Static

This will complete the internal data transformation on this request.

Parameters

$readonly

boolean
  • OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)

Constructor overriding - make sure that a developer cannot instantiate

__construct() 

Perform a hash-bits check on the session ID

_checkId(string $id) : boolean
Static

Parameters

$id

string

Session ID

Returns

boolean

namespaceGet() - Get $name variable from $namespace, returning by reference.

_namespaceGet(string $namespace, string $name = null) : mixed
InheritedStatic

Parameters

$namespace

string

$name

string

Returns

mixed

namespaceGetAll() - Get an array containing $namespace, including expiring data.

_namespaceGetAll(string $namespace) : mixed
InheritedStatic

Parameters

$namespace

string

Returns

mixed

namespaceIsset() - check to see if a namespace or a variable within a namespace is set

_namespaceIsset(string $namespace, string $name = null) : boolean
InheritedStatic

Parameters

$namespace

string

$name

string

Returns

boolean

namespaceUnset() - unset a namespace or a variable within a namespace

_namespaceUnset(string $namespace, string $name = null) : void
InheritedStatic

Parameters

$namespace

string

$name

string

Exceptions

\Zend_Session_Exception

_processGlobalMetadata() - this method initizes the sessions GLOBAL metadata, mostly global data expiration calculations.

_processStartupMetadataGlobal() : void
Static

_processValidator() - internal function that is called in the existence of VALID metadata

_processValidators() : void
Static

Exceptions

\Zend_Session_Exception

 Properties

 

Since expiring data is handled at startup to avoid __destruct difficulties, the data that will be expiring at end of this request is held here

$_expiringData : array

Default

array()
Static
 

Whether or not session permits reading (reading data in $_SESSION[])

$_readable : boolean

Default

false
Static
 

$_throwStartupException

$_throwStartupExceptions : boolean | \bitset

Default

true
Static
 

Whether or not session permits writing (modification of $_SESSION[])

$_writable : boolean

Default

false
Static
 

Private list of php's ini values for ext/session null values will default to the php.ini value, otherwise the value below will overwrite the default ini value, unless the user has set an option explicity with setOptions()

$_defaultOptions : array

Default

array('save_path' => null, 'name' => null, 'save_handler' => null, 'gc_probability' => null, 'gc_divisor' => null, 'gc_maxlifetime' => null, 'serialize_handler' => null, 'cookie_lifetime' => null, 'cookie_path' => null, 'cookie_domain' => null, 'cookie_secure' => null, 'cookie_httponly' => null, 'use_cookies' => null, 'use_only_cookies' => 'on', 'referer_check' => null, 'entropy_file' => null, 'entropy_length' => null, 'cache_limiter' => null, 'cache_expire' => null, 'use_trans_sid' => null, 'bug_compat_42' => null, 'bug_compat_warn' => null, 'hash_function' => null, 'hash_bits_per_character' => null)
Static
 

Whether the default options listed in Zend_Session::$_localOptions have been set

$_defaultOptionsSet : boolean

Default

false
Static
 

Whether or not session has been destroyed via session_destroy()

$_destroyed : boolean

Default

false
Static
 

List of options pertaining to Zend_Session that can be set by developers using Zend_Session::setOptions(). This list intentionally duplicates the individual declaration of static "class" variables by the same names.

$_localOptions : array

Default

array('strict' => '_strict', 'remember_me_seconds' => '_rememberMeSeconds', 'throw_startup_exceptions' => '_throwStartupExceptions')
Static
 

Whether or not the session id has been regenerated this request.

$_regenerateIdState : integer

Default

0
Static

Id regeneration state <0 - regenerate requested when session is started 0 - do nothing

0 - already called session_regenerate_id()

 

Default number of seconds the session will be remembered for when asked to be remembered

$_rememberMeSeconds : integer

Default

1209600
Static
 

A reference to the set session save handler

$_saveHandler : \Zend_Session_SaveHandler_Interface

Default

null
Static
 

Whether or not session id cookie has been deleted

$_sessionCookieDeleted : boolean

Default

false
Static
 

Check whether or not the session was started

$_sessionStarted : boolean

Default

false
Static
 

Whether or not session must be initiated before usage

$_strict : boolean

Default

false
Static
 

Whether or not write close has been performed.

$_writeClosed : boolean

Default

false
Static

 Constants

 

Error message thrown when an action requires reading session data, but current Zend_Session is not marked as readable.

_THROW_NOT_READABLE_MSG = 'Zend_Session is not marked as readable.' 
 

Error message thrown when an action requires modification, but current Zend_Session has been marked as read-only.

_THROW_NOT_WRITABLE_MSG = 'Zend_Session is currently marked as read-only.'