mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-42839 MUC: Memcache server configuration too sensitive to whitespace
This commit is contained in:
parent
d214057cad
commit
5c138b258d
2 changed files with 12 additions and 2 deletions
7
cache/stores/memcache/lib.php
vendored
7
cache/stores/memcache/lib.php
vendored
|
@ -350,7 +350,12 @@ class cachestore_memcache extends cache_store implements cache_is_configurable {
|
||||||
$lines = explode("\n", $data->servers);
|
$lines = explode("\n", $data->servers);
|
||||||
$servers = array();
|
$servers = array();
|
||||||
foreach ($lines as $line) {
|
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);
|
$servers[] = explode(':', $line, 3);
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
|
|
7
cache/stores/memcached/lib.php
vendored
7
cache/stores/memcached/lib.php
vendored
|
@ -374,7 +374,12 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
|
||||||
$lines = explode("\n", $data->servers);
|
$lines = explode("\n", $data->servers);
|
||||||
$servers = array();
|
$servers = array();
|
||||||
foreach ($lines as $line) {
|
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);
|
$servers[] = explode(':', $line, 3);
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue