From 7b8efcc23d68e34c547b3c2910e41d77c6b59c96 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 17 Jul 2018 02:05:06 -0400 Subject: [PATCH] Fix config value type in MemcachedCacheDriver - Remove default config values set in CacheDriverFactory --- src/Core/Cache/CacheDriverFactory.php | 10 +++++----- src/Core/Cache/MemcachedCacheDriver.php | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Core/Cache/CacheDriverFactory.php b/src/Core/Cache/CacheDriverFactory.php index 8fbdc1549e..307f52a2ea 100644 --- a/src/Core/Cache/CacheDriverFactory.php +++ b/src/Core/Cache/CacheDriverFactory.php @@ -24,20 +24,20 @@ class CacheDriverFactory switch ($driver) { case 'memcache': - $memcache_host = Config::get('system', 'memcache_host', '127.0.0.1'); - $memcache_port = Config::get('system', 'memcache_port', 11211); + $memcache_host = Config::get('system', 'memcache_host'); + $memcache_port = Config::get('system', 'memcache_port'); return new MemcacheCacheDriver($memcache_host, $memcache_port); break; case 'memcached': - $memcached_hosts = Config::get('system', 'memcached_hosts', [['127.0.0.1', 11211]]); + $memcached_hosts = Config::get('system', 'memcached_hosts'); return new MemcachedCacheDriver($memcached_hosts); break; case 'redis': - $redis_host = Config::get('system', 'redis_host', '127.0.0.1'); - $redis_port = Config::get('system', 'redis_port', 6379); + $redis_host = Config::get('system', 'redis_host'); + $redis_port = Config::get('system', 'redis_port'); return new RedisCacheDriver($redis_host, $redis_port); break; diff --git a/src/Core/Cache/MemcachedCacheDriver.php b/src/Core/Cache/MemcachedCacheDriver.php index 8b752fb3a8..4397892a9e 100644 --- a/src/Core/Cache/MemcachedCacheDriver.php +++ b/src/Core/Cache/MemcachedCacheDriver.php @@ -41,7 +41,9 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr $this->memcached = new Memcached(); array_walk($memcached_hosts, function (&$value) { - $value = array_map('trim', explode(',', $value)); + if (is_string($value)) { + $value = array_map('trim', explode(',', $value)); + } }); $this->memcached->addServers($memcached_hosts);