mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix issue with memcache and domains starting with letter "u"
This commit is contained in:
parent
277f641108
commit
359c0ab816
4 changed files with 24 additions and 2 deletions
|
@ -104,7 +104,7 @@ class MemcacheEngine extends CacheEngine {
|
||||||
* @return array Array containing host, port
|
* @return array Array containing host, port
|
||||||
*/
|
*/
|
||||||
protected function _parseServerString($server) {
|
protected function _parseServerString($server) {
|
||||||
if ($server[0] === 'u') {
|
if (strpos($server, 'unix://') === 0) {
|
||||||
return array($server, 0);
|
return array($server, 0);
|
||||||
}
|
}
|
||||||
if (substr($server, 0, 1) === '[') {
|
if (substr($server, 0, 1) === '[') {
|
||||||
|
|
|
@ -185,7 +185,7 @@ 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 ($server[0] === 'u') {
|
if (strpos($server, 'unix://') === 0) {
|
||||||
return array($server, 0);
|
return array($server, 0);
|
||||||
}
|
}
|
||||||
if (substr($server, 0, 1) === '[') {
|
if (substr($server, 0, 1) === '[') {
|
||||||
|
|
|
@ -161,6 +161,17 @@ class MemcacheEngineTest extends CakeTestCase {
|
||||||
$this->assertTrue($result);
|
$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.
|
* test non latin domains.
|
||||||
*
|
*
|
||||||
|
|
|
@ -400,6 +400,17 @@ class MemcachedEngineTest extends CakeTestCase {
|
||||||
$this->assertTrue($result);
|
$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.
|
* test non latin domains.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue