Session.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Session  
Since
Preview Release 0.2  
Version
$Id$  

\Zend_Session

Package: Zend_Session
Zend_Session
Parent(s)
\Zend_Session_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprivatearray $_defaultOptions = 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
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()
Default valuearray('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)Details
Type
array
>VPropertyprivatebool $_defaultOptionsSet = false
static
Whether the default options listed in Zend_Session::$_localOptions have been set
Default valuefalseDetails
Type
bool
>VPropertyprivatebool $_destroyed = false
static
Whether or not session has been destroyed via session_destroy()
Default valuefalseDetails
Type
bool
>VPropertyprivatearray $_localOptions = array('strict' => '_strict', 'remember_me_seconds' => '_rememberMeSeconds', 'throw_startup_exceptions' => '_throwStartupExceptions')
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.
Default valuearray('strict' => '_strict', 'remember_me_seconds' => '_rememberMeSeconds', 'throw_startup_exceptions' => '_throwStartupExceptions')Details
Type
array
>VPropertyprivateint $_regenerateIdState = 0
static
Whether or not the session id has been regenerated this request.
Id regeneration state <0 - regenerate requested when session is started 0 - do nothing >0 - already called session_regenerate_id()
Default value0Details
Type
int
>VPropertyprivateint $_rememberMeSeconds = 1209600
static
Default number of seconds the session will be remembered for when asked to be remembered
Default value1209600Details
Type
int
>VPropertyprivate\Zend_Session_SaveHandler_Interface $_saveHandler = null
static
A reference to the set session save handler
Default valuenullDetails
Type
\Zend_Session_SaveHandler_Interface
>VPropertyprivatebool $_sessionCookieDeleted = false
static
Whether or not session id cookie has been deleted
Default valuefalseDetails
Type
bool
>VPropertyprivatebool $_sessionStarted = false
static
Check whether or not the session was started
Default valuefalseDetails
Type
bool
>VPropertyprivatebool $_strict = false
static
Whether or not session must be initiated before usage
Default valuefalseDetails
Type
bool
>VPropertyprotectedbool|\bitset $_throwStartupExceptions = true
static
$_throwStartupException
Default valuetrueDetails
Type
bool | \bitset
>VPropertyprivatebool $_writeClosed = false
static
Whether or not write close has been performed.
Default valuefalseDetails
Type
bool

Methods

methodprotected__construct() : void

Constructor overriding - make sure that a developer cannot instantiate

methodprotected_checkId(string $id) : bool
static

Perform a hash-bits check on the session ID

Parameters
NameTypeDescription
$idstring

Session ID

Returns
TypeDescription
bool
methodprivate_processStartupMetadataGlobal() : void
static

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

methodprivate_processValidators() : void
static

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

Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicdestroy(bool $remove_cookie = true, bool $readonly = true) : void
static

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

Parameters
NameTypeDescription
$remove_cookiebool
  • OPTIONAL remove session id cookie, defaults to true (remove cookie)
$readonlybool
  • OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)
methodpublicexpireSessionCookie() : void
static

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

methodpublicforgetMe() : 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.

methodpublicgetId() : string
static

getId() - get the current session id

Returns
TypeDescription
string
methodpublicgetIterator() : \ArrayObject
static

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

Returns
TypeDescription
\ArrayObject
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicgetOptions(string $optionName = null) : array | string
static

getOptions()

Parameters
NameTypeDescription
$optionNamestring

OPTIONAL

Returns
TypeDescription
array | string
methodpublicgetSaveHandler() : \Zend_Session_SaveHandler_Interface
static

getSaveHandler() - Get the session Save Handler

methodpublicisDestroyed() : bool
static

Whether or not session has been destroyed via session_destroy()

Returns
TypeDescription
bool
methodpublicisReadable() : bool
static

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

Returns
TypeDescription
bool
methodpublicisRegenerated() : bool
static

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

Returns
TypeDescription
bool
methodpublicisStarted() : bool
static

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

Returns
TypeDescription
bool
methodpublicisWritable() : bool
static

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

Returns
TypeDescription
bool
methodpublicnamespaceGet(string $namespace) : array
static

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

Parameters
NameTypeDescription
$namespacestring
Returns
TypeDescription
array
methodpublicnamespaceIsset(string $namespace) : bool
static

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

Parameters
NameTypeDescription
$namespacestring
Returns
TypeDescription
bool
methodpublicnamespaceUnset(string $namespace) : void
static

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

Parameters
NameTypeDescription
$namespacestring
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicregenerateId() : void
static

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.

Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicregisterValidator(\Zend_Session_Validator_Interface $validator) : void
static

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

Parameters
NameTypeDescription
$validator\Zend_Session_Validator_Interface
methodpublicrememberMe(int $seconds = null) : void
static

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.

Parameters
NameTypeDescription
$secondsint

OPTIONAL specifies TTL for cookie in seconds from present time

methodpublicrememberUntil(int $seconds = 0) : void
static

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()

Parameters
NameTypeDescription
$secondsint
methodpublicsessionExists() : bool
static

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

Returns
TypeDescription
bool
methodpublicsetId(string $id) : void
static

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

Parameters
NameTypeDescription
$idstring
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicsetOptions(array $userOptions = array()) : void
static

setOptions - set both the class specified

Parameters
NameTypeDescription
$userOptionsarray
  • pass-by-keyword style array of
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicsetSaveHandler( $saveHandler) : void
static

setSaveHandler() - Session Save Handler assignment

Parameters
NameTypeDescription
$saveHandler
Throws
ExceptionDescription
\Zend_Session_ExceptionWhen the session_set_save_handler call fails
methodpublicstart(bool | array $options = false) : void
static

start() - Start the session.

Parameters
NameTypeDescription
$optionsbool | array

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

Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicstop() : void
static

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

methodpublicwriteClose(bool $readonly = true) : void
static

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

This will complete the internal data transformation on this request.
Parameters
NameTypeDescription
$readonlybool
  • OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)
Documentation was generated by phpDocumentor 2.2.0 .