From ff036416bfa31dcb65c90fce3820fd16f74ef546 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 14 Sep 2015 13:48:58 +0000 Subject: [PATCH] fix commented out reuse of already instanciated provider, and fix PHP Notice in memcache provider --- phpgwapi/inc/class.egw_cache.inc.php | 2 +- phpgwapi/inc/class.egw_cache_memcache.inc.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.egw_cache.inc.php b/phpgwapi/inc/class.egw_cache.inc.php index d7e93622b7..bb2526e8ad 100644 --- a/phpgwapi/inc/class.egw_cache.inc.php +++ b/phpgwapi/inc/class.egw_cache.inc.php @@ -497,7 +497,7 @@ class egw_cache if ($level != self::TREE) $level = self::INSTANCE; - //if (!isset($providers[$level])) + if (!isset($providers[$level])) { $params = $GLOBALS['egw_info']['server']['cache_provider_'.strtolower($level)]; if (!isset($params) && $level == self::INSTANCE && isset(self::$default_provider)) diff --git a/phpgwapi/inc/class.egw_cache_memcache.inc.php b/phpgwapi/inc/class.egw_cache_memcache.inc.php index c4e5438a59..dcdfd92043 100644 --- a/phpgwapi/inc/class.egw_cache_memcache.inc.php +++ b/phpgwapi/inc/class.egw_cache_memcache.inc.php @@ -62,8 +62,9 @@ class egw_cache_memcache extends egw_cache_provider_check implements egw_cache_p $ok = false; foreach($params as $host_port) { - list($host,$port) = explode(':',$host_port); - if (!$port) $port = 11211; // default port + $parts = explode(':',$host_port); + $host = array_shift($parts); + $port = $parts ? array_shift($parts) : 11211; // default port $ok = $this->memcache->addServer($host,$port) || $ok; //error_log(__METHOD__."(".array2string($params).") memcache->addServer('$host',$port) = ".(int)$ok);