Zend Framework  1.12
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
Zend_Session Class Reference

Static Public Member Functions

static setOptions (array $userOptions=array())
 setOptions - set both the class specified
 
static getOptions ($optionName=null)
 getOptions()
 
static setSaveHandler (Zend_Session_SaveHandler_Interface $saveHandler)
 setSaveHandler() - Session Save Handler assignment
 
static getSaveHandler ()
 getSaveHandler() - Get the session Save Handler
 
static regenerateId ()
 regenerateId() - Regenerate the session id.
 
static rememberMe ($seconds=null)
 rememberMe() - Write a persistent cookie that expires after a number of seconds in the future.
 
static forgetMe ()
 forgetMe() - Write a volatile session cookie, removing any persistent cookie that may have existed.
 
static rememberUntil ($seconds=0)
 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()
 
static sessionExists ()
 sessionExists() - whether or not a session exists for the current request
 
static isDestroyed ()
 Whether or not session has been destroyed via session_destroy()
 
static start ($options=false)
 start() - Start the session.
 
static isStarted ()
 isStarted() - convenience method to determine if the session is already started.
 
static isRegenerated ()
 isRegenerated() - convenience method to determine if session_regenerate_id() has been called during this request by Zend_Session.
 
static getId ()
 getId() - get the current session id
 
static setId ($id)
 setId() - set an id to a user specified id
 
static registerValidator (Zend_Session_Validator_Interface $validator)
 registerValidator() - register a validator that will attempt to validate this session for every future request
 
static stop ()
 stop() - Disable write access.
 
static writeClose ($readonly=true)
 writeClose() - Shutdown the sesssion, close writing and detach $_SESSION from the back-end storage mechanism.
 
static destroy ($remove_cookie=true, $readonly=true)
 destroy() - This is used to destroy session data, and optionally, the session cookie itself
 
static expireSessionCookie ()
 expireSessionCookie() - Sends an expired session id cookie, causing the client to delete the session cookie
 
static namespaceIsset ($namespace)
 namespaceIsset() - check to see if a namespace is set
 
static namespaceUnset ($namespace)
 namespaceUnset() - unset a namespace or a variable within a namespace
 
static namespaceGet ($namespace)
 namespaceGet() - get all variables in a namespace Deprecated: Use getIterator() in Zend_Session_Namespace.
 
static getIterator ()
 getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface
 
static isWritable ()
 isWritable() - returns a boolean indicating if namespaces can write (use setters)
 
static isReadable ()
 isReadable() - returns a boolean indicating if namespaces can write (use setters)
 

Static Public Attributes

static $_unitTestEnabled = false
 Whether or not Zend_Session is being used with unit tests.
 

Protected Member Functions

 __construct ()
 Constructor overriding - make sure that a developer cannot instantiate.
 

Static Protected Member Functions

static _checkId ($id)
 Perform a hash-bits check on the session ID.
 
- Static Protected Member Functions inherited from Zend_Session_Abstract
static _namespaceIsset ($namespace, $name=null)
 namespaceIsset() - check to see if a namespace or a variable within a namespace is set
 
static _namespaceUnset ($namespace, $name=null)
 namespaceUnset() - unset a namespace or a variable within a namespace
 
static & _namespaceGet ($namespace, $name=null)
 namespaceGet() - Get $name variable from $namespace, returning by reference.
 
static _namespaceGetAll ($namespace)
 namespaceGetAll() - Get an array containing $namespace, including expiring data.
 

Static Protected Attributes

static $_throwStartupExceptions = true
 
- Static Protected Attributes inherited from Zend_Session_Abstract
static $_writable = false
 
static $_readable = false
 
static $_expiringData = array()
 

Additional Inherited Members

- Public Attributes inherited from Zend_Session_Abstract
const _THROW_NOT_WRITABLE_MSG = 'Zend_Session is currently marked as read-only.'
 Error message thrown when an action requires modification, but current Zend_Session has been marked as read-only.
 
const _THROW_NOT_READABLE_MSG = 'Zend_Session is not marked as readable.'
 Error message thrown when an action requires reading session data, but current Zend_Session is not marked as readable.
 

Constructor & Destructor Documentation

__construct ( )
protected

Constructor overriding - make sure that a developer cannot instantiate.

Member Function Documentation

static _checkId (   $id)
staticprotected

Perform a hash-bits check on the session ID.

Parameters
string$idSession ID
Returns
bool
static destroy (   $remove_cookie = true,
  $readonly = true 
)
static

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

Parameters
bool$remove_cookie- OPTIONAL remove session id cookie, defaults to true (remove cookie)
bool$readonly- OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)
Returns
void
static expireSessionCookie ( )
static

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

Returns
void
static forgetMe ( )
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.

Returns
void
static getId ( )
static

getId() - get the current session id

Returns
string
static getIterator ( )
static

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

Exceptions
Zend_Session_Exception
Returns
ArrayObject
See Also
Zend_Session_Exception
static getOptions (   $optionName = null)
static

getOptions()

Parameters
string$optionNameOPTIONAL
Returns
array|string
static getSaveHandler ( )
static

getSaveHandler() - Get the session Save Handler

Returns
Zend_Session_SaveHandler_Interface
static isDestroyed ( )
static

Whether or not session has been destroyed via session_destroy()

Returns
bool
static isReadable ( )
static

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

Returns
bool
static isRegenerated ( )
static

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

Returns
bool
static isStarted ( )
static

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

Returns
bool
static isWritable ( )
static

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

Returns
bool
static namespaceGet (   $namespace)
static

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

Parameters
string$namespace
Returns
array
static namespaceIsset (   $namespace)
static

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

Parameters
string$namespace
Returns
bool
static namespaceUnset (   $namespace)
static

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

Parameters
string$namespace
Exceptions
Zend_Session_Exception
Returns
void
static regenerateId ( )
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.

Exceptions
Zend_Session_Exception
Returns
void
See Also
Zend_Session_Exception
static registerValidator ( Zend_Session_Validator_Interface  $validator)
static

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

Parameters
Zend_Session_Validator_Interface$validator
Returns
void
static rememberMe (   $seconds = null)
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
int$secondsOPTIONAL specifies TTL for cookie in seconds from present time
Returns
void
static rememberUntil (   $seconds = 0)
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
int$seconds
Returns
void
static sessionExists ( )
static

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

Returns
bool
static setId (   $id)
static

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

Exceptions
Zend_Session_Exception
Parameters
string$id
Returns
void
See Also
Zend_Session_Exception
Zend_Session_Exception
Zend_Session_Exception
static setOptions ( array  $userOptions = array())
static

setOptions - set both the class specified

Parameters
array$userOptions- pass-by-keyword style array of <option name, option value> pairs
Exceptions
Zend_Session_Exception
Returns
void
See Also
Zend_Session_Exception
static setSaveHandler ( Zend_Session_SaveHandler_Interface  $saveHandler)
static

setSaveHandler() - Session Save Handler assignment

Parameters
Zend_Session_SaveHandler_Interface$interface
Exceptions
Zend_Session_ExceptionWhen the session_set_save_handler call fails
Returns
void
static start (   $options = false)
static

start() - Start the session.

Parameters
bool | array$optionsOPTIONAL Either user supplied options, or flag indicating if start initiated automatically
Exceptions
Zend_Session_Exception
Returns
void
See Also
Zend_Session_Exception
Zend_Session_Exception
Zend_Session_Exception

Hack to throw exceptions on start instead of php errors

See Also
http://framework.zend.com/issues/browse/ZF-1325
Zend_Session_Exception
static stop ( )
static

stop() - Disable write access.

Optionally disable read (not implemented).

Returns
void
static writeClose (   $readonly = true)
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
bool$readonly- OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)
Returns
void

Member Data Documentation

$_throwStartupExceptions = true
staticprotected
$_unitTestEnabled = false
static

Whether or not Zend_Session is being used with unit tests.