summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2013-07-18 18:14:05 +0200
committerAndrey Andreev <narf@devilix.net>2013-07-18 18:14:05 +0200
commit6a3d7e50ce761570d88d82f96039304020f315bd (patch)
treeb1212b527f0b9a5fb0a962e81bd5440d9ba9b478
parentc0a1ce903cf1aa4e25ea8abc4cdbaac2753b9771 (diff)
Fix a Memcache(d) default configuration bug (based on #249)
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php26
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 9 insertions, 18 deletions
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index f04483d2c..35d91049a 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -51,9 +51,9 @@ class CI_Cache_memcached extends CI_Driver {
*/
protected $_memcache_conf = array(
'default' => array(
- 'default_host' => '127.0.0.1',
- 'default_port' => 11211,
- 'default_weight' => 1
+ 'host' => '127.0.0.1',
+ 'port' => 11211,
+ 'weight' => 1
)
);
@@ -173,7 +173,8 @@ class CI_Cache_memcached extends CI_Driver {
{
if (is_array($CI->config->config['memcached']))
{
- $this->_memcache_conf = NULL;
+ $defaults = $this->_memcache_conf['default'];
+ $this->_memcache_conf = array();
foreach ($CI->config->config['memcached'] as $name => $conf)
{
@@ -198,20 +199,9 @@ class CI_Cache_memcached extends CI_Driver {
foreach ($this->_memcache_conf as $cache_server)
{
- if ( ! array_key_exists('hostname', $cache_server))
- {
- $cache_server['hostname'] = $this->_memcache_conf['default']['default_host'];
- }
-
- if ( ! array_key_exists('port', $cache_server))
- {
- $cache_server['port'] = $this->_memcache_conf['default']['default_port'];
- }
-
- if ( ! array_key_exists('weight', $cache_server))
- {
- $cache_server['weight'] = $this->_memcache_conf['default']['default_weight'];
- }
+ isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host'];
+ isset($cache_server['port']) OR $cache_server['port'] = $defaults['host'];
+ isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight'];
if (get_class($this->_memcached) === 'Memcache')
{
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 4cbbda70e..59ba5cb80 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -593,6 +593,7 @@ Bug fixes for 3.0
- Fixed a bug (#2498) - :doc:`Form Validation Library <libraries/form_validation>` rule **valid_base64** only checked characters instead of actual validity.
- Fixed a bug (#2425) - OCI8 :doc:`database <database>` driver's method ``stored_procedure()`` didn't log an error unless **db_debug** was set to TRUE.
- Fixed a bug (#2490) - :doc:`Database Class <database/queries>` method ``query()`` returning boolean instead of a result object for PostgreSQL-specific *INSERT INTO ... RETURNING* statements.
+- Fixed a bug (#249) - :doc:`Cache Library <libraries/caching>` didn't properly handle Memcache(d) configurations with missing options.
Version 2.1.4
=============