From: Michael M Slusarz Date: Mon, 18 Oct 2010 21:27:33 +0000 (-0600) Subject: Bug #9315: Fix setting session_cache_limiter value X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0ab36983a478f9137f04e428f85ccd389e617710;p=horde.git Bug #9315: Fix setting session_cache_limiter value --- diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 85050a0c5..e61dabe8b 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -184,7 +184,7 @@ class Horde_Registry // Chicken/egg: Browser object doesn't exist yet. $browser = new Horde_Core_Browser(); if ($browser->isBrowser('mozilla')) { - session_cache_limiter('private, must-revalidate'); + $args['session_cache_limiter'] = 'private, must-revalidate'; } break; @@ -198,7 +198,7 @@ class Horde_Registry } $classname = __CLASS__; - $registry = $GLOBALS['registry'] = new $classname($s_ctrl); + $registry = $GLOBALS['registry'] = new $classname($s_ctrl, $args['session_cache_limiter']); $registry->initialApp = $app; $appob = $registry->getApiInstance($app, 'application'); @@ -244,10 +244,11 @@ class Horde_Registry * Create a new Horde_Registry instance. * * @param integer $session_flags Any session flags. + * @param string $cache_limiter The cache limiter to use. * * @throws Horde_Exception */ - public function __construct($session_flags = 0) + protected function __construct($session_flags, $cache_limiter) { /* Define autoloader callbacks. */ $callbacks = array( @@ -368,15 +369,16 @@ class Horde_Registry } /* Start a session. */ + $GLOBALS['session'] = $session = new Horde_Session(); if ($session_flags & self::SESSION_NONE || (PHP_SAPI == 'cli') || (((PHP_SAPI == 'cgi') || (PHP_SAPI == 'cgi-fcgi')) && empty($_SERVER['SERVER_NAME']))) { /* Never start a session if the session flags include SESSION_NONE. */ - $GLOBALS['session'] = $session = new Horde_Session(false); + $session->setup(false, $cache_limiter); } else { - $GLOBALS['session'] = $session = new Horde_Session(); + $session->setup(true, $cache_limiter); if ($session_flags & self::SESSION_READONLY) { /* Close the session immediately so no changes can be made but values are still available. */ diff --git a/framework/Core/lib/Horde/Session.php b/framework/Core/lib/Horde/Session.php index a01f5e663..989ff06df 100644 --- a/framework/Core/lib/Horde/Session.php +++ b/framework/Core/lib/Horde/Session.php @@ -52,26 +52,24 @@ class Horde_Session implements ArrayAccess /** * Constructor. - * - * @param boolean $start Initiate the session? */ - public function __construct($start = true) + public function __construct() { $this->_lzf = Horde_Util::extensionExists('lzf'); - - $this->setup($start); } /** * Sets a custom session handler up, if there is one. * - * @param boolean $start Initiate the session? + * @param boolean $start Initiate the session? + * @param string $cache_limiter Override for the session cache limiter + * value. * * @throws Horde_Exception */ - public function setup($start = true) + public function setup($start = true, $cache_limiter = null) { - global $conf, $registry; + global $conf; ini_set('url_rewriter.tags', 0); if (empty($conf['session']['use_only_cookies'])) { @@ -90,7 +88,7 @@ class Horde_Session implements ArrayAccess $conf['cookie']['domain'], $conf['use_ssl'] == 1 ? 1 : 0 ); - session_cache_limiter(is_null($registry->initParams['session_cache_limiter']) ? $conf['session']['cache_limiter'] : $registry->initParams['session_cache_limiter']); + session_cache_limiter(is_null($cache_limiter) ? $conf['session']['cache_limiter'] : $cache_limiter); session_name(urlencode($conf['session']['name'])); /* We want to create an instance here, not get, since we may be