Make sure prefix is always initialized to empty.
authorChuck Hagenbuch <chuck@horde.org>
Tue, 15 Jun 2010 02:20:52 +0000 (22:20 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Tue, 15 Jun 2010 02:20:52 +0000 (22:20 -0400)
We don't want to access superglobals from library constructors; if we want the
prefix to be the server name by default for Horde, we should set that in the
factory.

framework/Cache/lib/Horde/Cache/Base.php

index 2b5a17c..e5cf446 100644 (file)
@@ -22,7 +22,8 @@ abstract class Horde_Cache_Base
      * @var array
      */
     protected $_params = array(
-        'lifetime' => 86400
+        'lifetime' => 86400,
+        'prefix' => '',
     );
 
     /**
@@ -50,11 +51,6 @@ abstract class Horde_Cache_Base
         }
 
         $this->_params = array_merge($this->_params, $params);
-        if (empty($this->_params['prefix'])) {
-            $this->_params['prefix'] = $_SERVER['SERVER_NAME']
-                ? $_SERVER['SERVER_NAME']
-                : $_SERVER['HOSTNAME'];
-        }
     }
 
     /**