Merge pull request #8020 from tersmitten/fix-broken-memcached-socket-connection-2x

Memcached can not connect using a socket
This commit is contained in:
Mark Story 2016-01-12 22:08:19 -05:00
commit b4960c7965
2 changed files with 4 additions and 3 deletions

View file

@ -185,8 +185,9 @@ class MemcachedEngine extends CacheEngine {
* @return array Array containing host, port * @return array Array containing host, port
*/ */
protected function _parseServerString($server) { protected function _parseServerString($server) {
if (strpos($server, 'unix://') === 0) { $socketTransport = 'unix://';
return array($server, 0); if (strpos($server, $socketTransport) === 0) {
return array(substr($server, strlen($socketTransport)), 0);
} }
if (substr($server, 0, 1) === '[') { if (substr($server, 0, 1) === '[') {
$position = strpos($server, ']:'); $position = strpos($server, ']:');

View file

@ -433,7 +433,7 @@ class MemcachedEngineTest extends CakeTestCase {
public function testParseServerStringUnix() { public function testParseServerStringUnix() {
$Memcached = new TestMemcachedEngine(); $Memcached = new TestMemcachedEngine();
$result = $Memcached->parseServerString('unix:///path/to/memcachedd.sock'); $result = $Memcached->parseServerString('unix:///path/to/memcachedd.sock');
$this->assertEquals(array('unix:///path/to/memcachedd.sock', 0), $result); $this->assertEquals(array('/path/to/memcachedd.sock', 0), $result);
} }
/** /**