import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -15,9 +15,9 @@
*
* @category Zend
* @package Zend_Session
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Session.php 15577 2009-05-14 12:43:34Z matthew $
* @version $Id: Session.php 16207 2009-06-21 19:17:51Z thomas $
* @since Preview Release 0.2
*/
@ -43,7 +43,7 @@ require_once 'Zend/Session/SaveHandler/Interface.php';
*
* @category Zend
* @package Zend_Session
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 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
@ -56,6 +56,13 @@ class Zend_Session extends Zend_Session_Abstract
*/
public static $_unitTestEnabled = false;
/**
* $_throwStartupException
*
* @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
*
@ -120,7 +127,8 @@ class Zend_Session extends Zend_Session_Abstract
*/
private static $_localOptions = array(
'strict' => '_strict',
'remember_me_seconds' => '_rememberMeSeconds'
'remember_me_seconds' => '_rememberMeSeconds',
'throw_startup_exceptions' => '_throwStartupExceptions'
);
/**
@ -221,6 +229,31 @@ class Zend_Session extends Zend_Session_Abstract
}
}
/**
* getOptions()
*
* @param string $optionName OPTIONAL
* @return array|string
*/
public static function getOptions($optionName = null)
{
$options = array();
foreach (ini_get_all('session') as $sysOptionName => $sysOptionValues) {
$options[substr($sysOptionName, 8)] = $sysOptionValues['local_value'];
}
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;
}
/**
* setSaveHandler() - Session Save Handler assignment
@ -413,6 +446,7 @@ class Zend_Session extends Zend_Session_Abstract
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';
@ -431,17 +465,32 @@ 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) {
require_once 'Zend/Session/Exception.php';
set_error_handler(array('Zend_Session_Exception', 'handleSessionStartError'), E_ALL);
session_start();
restore_error_handler();
if (Zend_Session_Exception::$sessionStartError !== null) {
set_error_handler(array('Zend_Session_Exception', 'handleSilentWriteClose'), E_ALL);
session_write_close();
restore_error_handler();
throw new Zend_Session_Exception(__CLASS__ . '::' . __FUNCTION__ . '() - ' . Zend_Session_Exception::$sessionStartError);
if (self::$_throwStartupExceptions) {
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);
}
session_write_close();
if (self::$_throwStartupExceptions) {
restore_error_handler();
throw new Zend_Session_Exception(__CLASS__ . '::' . __FUNCTION__ . '() - ' . Zend_Session_Exception::$sessionStartError);
}
}
}
@ -758,6 +807,7 @@ class Zend_Session extends Zend_Session_Abstract
public static function namespaceUnset($namespace)
{
parent::_namespaceUnset($namespace);
Zend_Session_Namespace::resetSingleInstance($namespace);
}