diff options
Diffstat (limited to 'libs/Zend/Session.php')
-rw-r--r-- | libs/Zend/Session.php | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/libs/Zend/Session.php b/libs/Zend/Session.php index 31ab5a50a1..e361d15db2 100644 --- a/libs/Zend/Session.php +++ b/libs/Zend/Session.php @@ -15,9 +15,9 @@ * * @category Zend * @package Zend_Session - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Session.php 18342 2009-09-21 16:31:18Z alexander $ + * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $ * @since Preview Release 0.2 */ @@ -25,17 +25,17 @@ /** * @see Zend_Session_Abstract */ -require_once 'Zend/Session/Abstract.php'; +// require_once 'Zend/Session/Abstract.php'; /** * @see Zend_Session_Namespace */ -require_once 'Zend/Session/Namespace.php'; +// require_once 'Zend/Session/Namespace.php'; /** * @see Zend_Session_SaveHandler_Interface */ -require_once 'Zend/Session/SaveHandler/Interface.php'; +// require_once 'Zend/Session/SaveHandler/Interface.php'; /** @@ -43,7 +43,7 @@ require_once 'Zend/Session/SaveHandler/Interface.php'; * * @category Zend * @package Zend_Session - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Session extends Zend_Session_Abstract @@ -62,7 +62,7 @@ class Zend_Session extends Zend_Session_Abstract * @var bool|bitset This could also be a combiniation of error codes to catch */ protected static $_throwStartupExceptions = true; - + /** * Check whether or not the session was started * @@ -223,7 +223,7 @@ class Zend_Session extends Zend_Session_Abstract } else { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("Unknown option: $userOptionName = $userOptionValue"); } } @@ -244,14 +244,14 @@ class Zend_Session extends Zend_Session_Abstract foreach (self::$_localOptions as $localOptionName => $localOptionMemberName) { $options[$localOptionName] = self::${$localOptionMemberName}; } - + if ($optionName) { if (array_key_exists($optionName, $options)) { return $options[$optionName]; } return null; } - + return $options; } @@ -303,7 +303,7 @@ class Zend_Session extends Zend_Session_Abstract { if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("You must call " . __CLASS__ . '::' . __FUNCTION__ . "() before any output has been sent to the browser; output started in {$filename}/{$linenum}"); } @@ -427,7 +427,7 @@ class Zend_Session extends Zend_Session_Abstract public static function start($options = false) { if (self::$_sessionStarted && self::$_destroyed) { - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception('The session was explicitly destroyed during this request, attempting to re-start is not allowed.'); } @@ -443,14 +443,14 @@ class Zend_Session extends Zend_Session_Abstract // In strict mode, do not allow auto-starting Zend_Session, such as via "new Zend_Session_Namespace()" if (self::$_strict && $options === true) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception('You must explicitly start the session with Zend_Session::start() when session options are set to strict.'); } $filename = $linenum = null; if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("Session must be started before any output has been sent to the browser;" . " output started in {$filename}/{$linenum}"); } @@ -458,7 +458,7 @@ class Zend_Session extends Zend_Session_Abstract // See http://www.php.net/manual/en/ref.session.php for explanation if (!self::$_unitTestEnabled && defined('SID')) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception('session has already been started by session.auto-start or session_start()'); } @@ -466,23 +466,23 @@ class Zend_Session extends Zend_Session_Abstract * Hack to throw exceptions on start instead of php errors * @see http://framework.zend.com/issues/browse/ZF-1325 */ - + $errorLevel = (is_int(self::$_throwStartupExceptions)) ? self::$_throwStartupExceptions : E_ALL; - + /** @see Zend_Session_Exception */ if (!self::$_unitTestEnabled) { - + if (self::$_throwStartupExceptions) { - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; set_error_handler(array('Zend_Session_Exception', 'handleSessionStartError'), $errorLevel); } - + $startedCleanly = session_start(); - + if (self::$_throwStartupExceptions) { restore_error_handler(); } - + if (!$startedCleanly || Zend_Session_Exception::$sessionStartError != null) { if (self::$_throwStartupExceptions) { set_error_handler(array('Zend_Session_Exception', 'handleSilentWriteClose'), $errorLevel); @@ -528,7 +528,7 @@ class Zend_Session extends Zend_Session_Abstract // Expire Namespace by Time (ENT) if (isset($namespace_metadata['ENT']) && ($namespace_metadata['ENT'] > 0) && (time() > $namespace_metadata['ENT']) ) { unset($_SESSION[$namespace]); - unset($_SESSION['__ZF'][$namespace]['ENT']); + unset($_SESSION['__ZF'][$namespace]); } // Expire Namespace by Global Hop (ENGH) @@ -540,7 +540,7 @@ class Zend_Session extends Zend_Session_Abstract parent::$_expiringData[$namespace] = $_SESSION[$namespace]; unset($_SESSION[$namespace]); } - unset($_SESSION['__ZF'][$namespace]['ENGH']); + unset($_SESSION['__ZF'][$namespace]); } } @@ -550,12 +550,11 @@ class Zend_Session extends Zend_Session_Abstract if (time() > $time) { unset($_SESSION[$namespace][$variable]); unset($_SESSION['__ZF'][$namespace]['ENVT'][$variable]); - - if (empty($_SESSION['__ZF'][$namespace]['ENVT'])) { - unset($_SESSION['__ZF'][$namespace]['ENVT']); - } } } + if (empty($_SESSION['__ZF'][$namespace]['ENVT'])) { + unset($_SESSION['__ZF'][$namespace]['ENVT']); + } } // Expire Namespace Variables by Global Hop (ENVGH) @@ -571,6 +570,9 @@ class Zend_Session extends Zend_Session_Abstract unset($_SESSION['__ZF'][$namespace]['ENVGH'][$variable]); } } + if(empty($_SESSION['__ZF'][$namespace]['ENVGH'])) { + unset($_SESSION['__ZF'][$namespace]['ENVGH']); + } } } @@ -630,20 +632,20 @@ class Zend_Session extends Zend_Session_Abstract { if (!self::$_unitTestEnabled && defined('SID')) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception('The session has already been started. The session id must be set first.'); } if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("You must call ".__CLASS__.'::'.__FUNCTION__. "() before any output has been sent to the browser; output started in {$filename}/{$linenum}"); } if (!is_string($id) || $id === '') { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception('You must provide a non-empty string as a session identifier.'); } @@ -772,14 +774,14 @@ class Zend_Session extends Zend_Session_Abstract private static function _processValidators() { foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) { - if (!class_exists($validator_name)) { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($validator_name); - } + // if (!class_exists($validator_name)) { + // require_once 'Zend/Loader.php'; + // Zend_Loader::loadClass($validator_name); + // } $validator = new $validator_name; if ($validator->validate() === false) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("This session is not valid according to {$validator_name}."); } } @@ -836,7 +838,7 @@ class Zend_Session extends Zend_Session_Abstract { if (parent::$_readable === false) { /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; + // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception(parent::_THROW_NOT_READABLE_MSG); } |