Skip to content

Commit

Permalink
Merge pull request #1383 from ytetsuro/fix/#1204
Browse files Browse the repository at this point in the history
fix TypeError in MemcachedHandler::__construct()
  • Loading branch information
lonnieezell authored Oct 31, 2018
2 parents 7f2e6a5 + 0181fb8 commit feed450
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions system/Cache/Handlers/MemcachedHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ class MemcachedHandler implements CacheInterface

//--------------------------------------------------------------------

public function __construct(array $config)
public function __construct($config)
{
$config = (array)$config;
$this->prefix = $config['prefix'] ?? '';

if ( ! empty($config))
{
$this->config = array_merge($this->config, $config);
$this->config = array_merge($this->config, $config['memcached']);
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/system/Cache/Handlers/MemcachedHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function setUp()

$this->config = new \Config\Cache();

$this->memcachedHandler = new MemcachedHandler($this->config->memcached, '127.0.0.1');
$this->memcachedHandler = new MemcachedHandler($this->config);
if (!$this->memcachedHandler->isSupported()) {
$this->markTestSkipped('Not support memcached and memcache');
}
Expand Down Expand Up @@ -74,7 +74,7 @@ public function testIncrement()

$config = new \Config\Cache();
$config->memcached['raw'] = true;
$memcachedHandler = new MemcachedHandler($config->memcached, '127.0.0.1');
$memcachedHandler = new MemcachedHandler($config);
$memcachedHandler->initialize();

$memcachedHandler->save(self::$key1, 1);
Expand All @@ -93,7 +93,7 @@ public function testDecrement()

$config = new \Config\Cache();
$config->memcached['raw'] = true;
$memcachedHandler = new MemcachedHandler($config->memcached, '127.0.0.1');
$memcachedHandler = new MemcachedHandler($config);
$memcachedHandler->initialize();

$memcachedHandler->save(self::$key1, 10);
Expand Down

0 comments on commit feed450

Please sign in to comment.