Skip to content

Commit

Permalink
Keep data in session storage if using a Null cache driver with Horde_…
Browse files Browse the repository at this point in the history
…Core_Cache_Session

Bug #13264

It makes zero sense to run IMP (or any Horde app) with a null cache
driver, but I guess we need to support those broken configs.
  • Loading branch information
slusarz committed Jul 3, 2014
1 parent e6536d6 commit ba60daa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions framework/Core/lib/Horde/Core/Cache/Session.php
Expand Up @@ -40,7 +40,7 @@ class Horde_Core_Cache_Session extends Horde_Cache_Storage_Base
* - cache: (Horde_Cache_Storage_Backend) [REQUIRED] The backend cache
* storage driver used to store large entries.
* - maxsize: (integer) The maximum size of the data to store in the
* session.
* session (0 to always store in session).
* - storage_key: (string) The storage key to save the session data
* under.
*/
Expand All @@ -58,6 +58,10 @@ public function __construct(array $params = array())
),
$params
));

if ($params['cache'] instanceof Horde_Cache_Storage_Null) {
$this->_params['maxsize'] = 0;
}
}

/**
Expand Down Expand Up @@ -92,7 +96,8 @@ public function set($key, $data, $lifetime = 0)
{
global $session;

if (strlen($data) > $this->_params['maxsize']) {
if ($this->_params['maxsize'] &&
(strlen($data) > $this->_params['maxsize'])) {
$this->_params['cache']->set($this->_getCid($key, false), $data);
$this->_stored[$key] = 1;
$this->_saveStored();
Expand Down

0 comments on commit ba60daa

Please sign in to comment.