Skip to content

Commit

Permalink
Merge pull request #8020 from tersmitten/fix-broken-memcached-socket-…
Browse files Browse the repository at this point in the history
…connection-2x

Memcached can not connect using a socket
  • Loading branch information
markstory committed Jan 13, 2016
2 parents 4de9212 + 8d472a5 commit b4960c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/Cake/Cache/Engine/MemcachedEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ protected function _setOptions() {
* @return array Array containing host, port
*/
protected function _parseServerString($server) {
if (strpos($server, 'unix://') === 0) {
return array($server, 0);
$socketTransport = 'unix://';
if (strpos($server, $socketTransport) === 0) {
return array(substr($server, strlen($socketTransport)), 0);
}
if (substr($server, 0, 1) === '[') {
$position = strpos($server, ']:');
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public function testParseServerStringNonLatin() {
public function testParseServerStringUnix() {
$Memcached = new TestMemcachedEngine();
$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);
}

/**
Expand Down

0 comments on commit b4960c7

Please sign in to comment.