MDL-42839 MUC: Memcache server configuration too sensitive to whitespace

This commit is contained in:
sam marshall 2013-11-12 12:23:10 +00:00
parent d214057cad
commit 5c138b258d
2 changed files with 12 additions and 2 deletions

View File

@ -350,7 +350,12 @@ class cachestore_memcache extends cache_store implements cache_is_configurable {
$lines = explode("\n", $data->servers);
$servers = array();
foreach ($lines as $line) {
$line = trim($line, ':');
// Trim surrounding colons and default whitespace.
$line = trim(trim($line), ":");
// Skip blank lines.
if ($line === '') {
continue;
}
$servers[] = explode(':', $line, 3);
}
return array(

View File

@ -374,7 +374,12 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
$lines = explode("\n", $data->servers);
$servers = array();
foreach ($lines as $line) {
$line = trim($line, ':');
// Trim surrounding colons and default whitespace.
$line = trim(trim($line), ":");
// Skip blank lines.
if ($line === '') {
continue;
}
$servers[] = explode(':', $line, 3);
}
return array(