Fix issue with memcache and domains starting with letter "u"

This commit is contained in:
Walther Lalk 2015-03-19 11:42:14 +02:00
parent 277f641108
commit 359c0ab816
4 changed files with 24 additions and 2 deletions

View file

@ -104,7 +104,7 @@ class MemcacheEngine extends CacheEngine {
* @return array Array containing host, port
*/
protected function _parseServerString($server) {
if ($server[0] === 'u') {
if (strpos($server, 'unix://') === 0) {
return array($server, 0);
}
if (substr($server, 0, 1) === '[') {

View file

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

View file

@ -161,6 +161,17 @@ class MemcacheEngineTest extends CakeTestCase {
$this->assertTrue($result);
}
/**
* test domain starts with u
*
* @return void
*/
public function testParseServerStringWithU() {
$Memcached = new TestMemcachedEngine();
$result = $Memcached->parseServerString('udomain.net:13211');
$this->assertEquals(array('udomain.net', '13211'), $result);
}
/**
* test non latin domains.
*

View file

@ -400,6 +400,17 @@ class MemcachedEngineTest extends CakeTestCase {
$this->assertTrue($result);
}
/**
* test domain starts with u
*
* @return void
*/
public function testParseServerStringWithU() {
$Memcached = new TestMemcachedEngine();
$result = $Memcached->parseServerString('udomain.net:13211');
$this->assertEquals(array('udomain.net', '13211'), $result);
}
/**
* test non latin domains.
*