Definition at line 49 of file Session.php.
◆ __construct()
Constructor overriding - make sure that a developer cannot instantiate
Definition at line 187 of file Session.php.
◆ _checkId()
Perform a hash-bits check on the session ID
- Parameters
-
- Returns
- bool
Definition at line 521 of file Session.php.
523 $saveHandler =
ini_get(
'session.save_handler');
524 if ($saveHandler ==
'cluster') {
525 $dashPos = strrpos(
$id,
'-');
527 $id = substr(
$id, $dashPos + 1);
531 $hashBitsPerChar =
ini_get(
'session.hash_bits_per_character');
532 if (!$hashBitsPerChar) {
533 $hashBitsPerChar = 5;
535 switch($hashBitsPerChar) {
536 case 4:
$pattern =
'^[0-9a-f]*$';
break;
537 case 5:
$pattern =
'^[0-9a-v]*$';
break;
538 case 6:
$pattern =
'^[0-9a-zA-Z-,]*$';
break;
◆ destroy()
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
Definition at line 744 of file Session.php.
746 if (self::$_unitTestEnabled) {
750 if (self::$_destroyed) {
755 parent::$_writable =
false;
759 self::$_destroyed =
true;
761 if ($remove_cookie) {
static expireSessionCookie()
◆ expireSessionCookie()
static expireSessionCookie |
( |
| ) |
|
|
static |
expireSessionCookie() - Sends an expired session id cookie, causing the client to delete the session cookie
- Returns
- void
Definition at line 772 of file Session.php.
774 if (self::$_unitTestEnabled) {
778 if (self::$_sessionCookieDeleted) {
782 self::$_sessionCookieDeleted =
true;
784 if (isset($_COOKIE[session_name()])) {
785 $cookie_params = session_get_cookie_params();
791 $cookie_params[
'path'],
792 $cookie_params[
'domain'],
793 $cookie_params[
'secure']
setcookie($name, $value, $expiry, $path, $domain, $secure, $httpOnly)
◆ forgetMe()
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
Definition at line 350 of file Session.php.
static rememberUntil($seconds=0)
◆ getId()
◆ getIterator()
getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface
- Exceptions
-
- Returns
- ArrayObject
- See also
- Zend_Session_Exception
Definition at line 868 of file Session.php.
870 if (parent::$_readable ===
false) {
872 #require_once 'Zend/Session/Exception.php'; 877 if (isset($_SESSION)) {
878 $spaces = array_keys($_SESSION);
879 foreach($spaces as $key => $space) {
880 if (!strncmp($space,
'__', 2) || !is_array($_SESSION[$space])) {
881 unset($spaces[$key]);
886 return new ArrayObject(array_merge($spaces, array_keys(parent::$_expiringData)));
◆ getOptions()
static getOptions |
( |
|
$optionName = null | ) |
|
|
static |
getOptions()
- Parameters
-
string | $optionName | OPTIONAL |
- Returns
- array|string
Definition at line 238 of file Session.php.
241 foreach (ini_get_all(
'session') as $sysOptionName => $sysOptionValues) {
242 $options[substr($sysOptionName, 8)] = $sysOptionValues[
'local_value'];
244 foreach (self::$_localOptions as $localOptionName => $localOptionMemberName) {
245 $options[$localOptionName] =
self::${$localOptionMemberName};
249 if (array_key_exists($optionName,
$options)) {
◆ getSaveHandler()
static getSaveHandler |
( |
| ) |
|
|
static |
◆ isDestroyed()
Whether or not session has been destroyed via session_destroy()
- Returns
- bool
Definition at line 408 of file Session.php.
410 return self::$_destroyed;
◆ isReadable()
isReadable() - returns a boolean indicating if namespaces can write (use setters)
- Returns
- bool
Definition at line 906 of file Session.php.
908 return parent::$_readable;
◆ isRegenerated()
◆ isStarted()
isStarted() - convenience method to determine if the session is already started.
- Returns
- bool
Definition at line 626 of file Session.php.
628 return self::$_sessionStarted;
◆ isWritable()
isWritable() - returns a boolean indicating if namespaces can write (use setters)
- Returns
- bool
Definition at line 895 of file Session.php.
897 return parent::$_writable;
◆ namespaceGet()
static namespaceGet |
( |
|
$namespace | ) |
|
|
static |
◆ namespaceIsset()
static namespaceIsset |
( |
|
$namespace | ) |
|
|
static |
namespaceIsset() - check to see if a namespace is set
- Parameters
-
- Returns
- bool
Definition at line 828 of file Session.php.
830 return parent::_namespaceIsset($namespace);
◆ namespaceUnset()
static namespaceUnset |
( |
|
$namespace | ) |
|
|
static |
namespaceUnset() - unset a namespace or a variable within a namespace
- Parameters
-
- Exceptions
-
- Returns
- void
Definition at line 841 of file Session.php.
843 parent::_namespaceUnset($namespace);
static resetSingleInstance($namespaceName=null)
◆ regenerateId()
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
-
- Returns
- void
- See also
- Zend_Session_Exception
Definition at line 307 of file Session.php.
309 if (!self::$_unitTestEnabled &&
headers_sent($filename, $linenum)) {
311 #require_once 'Zend/Session/Exception.php'; 313 "() before any output has been sent to the browser; output started in {$filename}/{$linenum}");
316 if ( !self::$_sessionStarted ) {
317 self::$_regenerateIdState = -1;
319 if (!self::$_unitTestEnabled) {
322 self::$_regenerateIdState = 1;
session_regenerate_id($var)
◆ registerValidator()
registerValidator() - register a validator that will attempt to validate this session for every future request
- Parameters
-
- Returns
- void
Definition at line 694 of file Session.php.
◆ rememberMe()
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 | $seconds | OPTIONAL specifies TTL for cookie in seconds from present time |
- Returns
- void
Definition at line 335 of file Session.php.
337 $seconds = (int) $seconds;
338 $seconds = ($seconds > 0) ? $seconds : self::$_rememberMeSeconds;
static rememberUntil($seconds=0)
◆ rememberUntil()
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
-
- Returns
- void
Definition at line 363 of file Session.php.
365 if (self::$_unitTestEnabled) {
370 $cookieParams = session_get_cookie_params();
372 session_set_cookie_params(
374 $cookieParams[
'path'],
375 $cookieParams[
'domain'],
376 $cookieParams[
'secure']
◆ sessionExists()
sessionExists() - whether or not a session exists for the current request
- Returns
- bool
Definition at line 389 of file Session.php.
391 if ((
bool)
ini_get(
'session.use_cookies') ==
true && isset($_COOKIE[session_name()])) {
393 }
elseif ((
bool)
ini_get(
'session.use_only_cookies') ==
false && isset($_REQUEST[session_name()])) {
395 }
elseif (self::$_unitTestEnabled) {
elseif(isset( $params[ 'redirect_parent']))
◆ setId()
setId() - set an id to a user specified id
- Exceptions
-
- Parameters
-
- Returns
- void
- See also
- Zend_Session_Exception
-
Zend_Session_Exception
-
Zend_Session_Exception
Definition at line 662 of file Session.php.
664 if (!self::$_unitTestEnabled && defined(
'SID')) {
666 #require_once 'Zend/Session/Exception.php'; 667 throw new Zend_Session_Exception(
'The session has already been started. The session id must be set first.');
670 if (!self::$_unitTestEnabled &&
headers_sent($filename, $linenum)) {
672 #require_once 'Zend/Session/Exception.php'; 674 "() before any output has been sent to the browser; output started in {$filename}/{$linenum}");
677 if (!is_string(
$id) ||
$id ===
'') {
679 #require_once 'Zend/Session/Exception.php';
◆ setOptions()
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
-
- Returns
- void
- See also
- Zend_Session_Exception
Definition at line 199 of file Session.php.
202 if (!self::$_defaultOptionsSet) {
203 foreach (self::$_defaultOptions as $defaultOptionName => $defaultOptionValue) {
204 if (isset(self::$_defaultOptions[$defaultOptionName])) {
205 ini_set(
"session.$defaultOptionName", $defaultOptionValue);
209 self::$_defaultOptionsSet =
true;
213 foreach ($userOptions as $userOptionName => $userOptionValue) {
215 $userOptionName = strtolower($userOptionName);
218 if (array_key_exists($userOptionName, self::$_defaultOptions)) {
219 ini_set(
"session.$userOptionName", $userOptionValue);
221 elseif (isset(self::$_localOptions[$userOptionName])) {
222 self::${self::$_localOptions[$userOptionName]} = $userOptionValue;
226 #require_once 'Zend/Session/Exception.php'; ini_set($varName, $newValue)
elseif(isset( $params[ 'redirect_parent']))
◆ setSaveHandler()
setSaveHandler() - Session Save Handler assignment
- Parameters
-
- Exceptions
-
- Returns
- void
Definition at line 265 of file Session.php.
267 self::$_saveHandler = $saveHandler;
269 if (self::$_unitTestEnabled) {
274 array(&$saveHandler,
'open'),
275 array(&$saveHandler,
'close'),
276 array(&$saveHandler,
'read'),
277 array(&$saveHandler,
'write'),
278 array(&$saveHandler,
'destroy'),
279 array(&$saveHandler,
'gc')
session_set_save_handler()
◆ start()
static start |
( |
|
$options = false | ) |
|
|
static |
start() - Start the session.
- Parameters
-
bool | array | $options | OPTIONAL Either user supplied options, or flag indicating if start initiated automatically |
- Exceptions
-
- 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
Definition at line 421 of file Session.php.
424 if ( self::getId() && !self::_checkId(self::getId()) ) {
428 self::$_regenerateIdState = -1;
431 if (self::$_sessionStarted && self::$_destroyed) {
432 #require_once 'Zend/Session/Exception.php'; 433 throw new Zend_Session_Exception(
'The session was explicitly destroyed during this request, attempting to re-start is not allowed.');
436 if (self::$_sessionStarted) {
441 if (!self::$_defaultOptionsSet) {
446 if (self::$_strict &&
$options ===
true) {
448 #require_once 'Zend/Session/Exception.php'; 449 throw new Zend_Session_Exception(
'You must explicitly start the session with Zend_Session::start() when session options are set to strict.');
452 $filename = $linenum =
null;
453 if (!self::$_unitTestEnabled &&
headers_sent($filename, $linenum)) {
455 #require_once 'Zend/Session/Exception.php'; 456 throw new Zend_Session_Exception(
"Session must be started before any output has been sent to the browser;" 457 .
" output started in {$filename}/{$linenum}");
461 if (!self::$_unitTestEnabled && defined(
'SID')) {
463 #require_once 'Zend/Session/Exception.php'; 464 throw new Zend_Session_Exception(
'session has already been started by session.auto-start or session_start()');
472 $errorLevel = (is_int(self::$_throwStartupExceptions)) ? self::$_throwStartupExceptions : E_ALL;
475 if (!self::$_unitTestEnabled) {
477 if (self::$_throwStartupExceptions) {
478 #require_once 'Zend/Session/Exception.php'; 479 set_error_handler(array(
'Zend_Session_Exception',
'handleSessionStartError'), $errorLevel);
482 $startedCleanly = session_start();
484 if (self::$_throwStartupExceptions) {
485 restore_error_handler();
489 if (self::$_throwStartupExceptions) {
490 set_error_handler(array(
'Zend_Session_Exception',
'handleSilentWriteClose'), $errorLevel);
492 session_write_close();
493 if (self::$_throwStartupExceptions) {
494 restore_error_handler();
500 parent::$_readable =
true;
501 parent::$_writable =
true;
502 self::$_sessionStarted =
true;
503 if (self::$_regenerateIdState === -1) {
508 if (isset($_SESSION[
'__ZF'][
'VALID'])) {
509 self::_processValidators();
512 self::_processStartupMetadataGlobal();
static setOptions(array $userOptions=array())
static $sessionStartError
◆ stop()
stop() - Disable write access. Optionally disable read (not implemented).
- Returns
- void
Definition at line 705 of file Session.php.
707 parent::$_writable =
false;
◆ writeClose()
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
Definition at line 718 of file Session.php.
720 if (self::$_unitTestEnabled) {
724 if (self::$_writeClosed) {
729 parent::$_writable =
false;
732 session_write_close();
733 self::$_writeClosed =
true;
◆ $_throwStartupExceptions
$_throwStartupExceptions = true |
|
staticprotected |
◆ $_unitTestEnabled
$_unitTestEnabled = false |
|
static |
The documentation for this class was generated from the following file: