Problem/Motivation
Check for config empty scenarios on $memory_config['maxmemory']
Steps to reproduce
i guess empty the config values
Proposed resolution
diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php
index 9ff362a071df04340db97c0e050839f25c23536f..037e636051f15a03f71779085ccd0158c152a5eb 100644
--- a/src/Controller/ReportController.php
+++ b/src/Controller/ReportController.php
@@ -169,7 +169,7 @@ class ReportController extends ControllerBase {
$end = microtime(TRUE);
$memory_config = $this->redis->config('get', 'maxmemory*');
- if ($memory_config['maxmemory']) {
+ if (!empty($memory_config['maxmemory'])) {
$memory_value = $this->t('@used_memory / @max_memory (@used_percentage%), maxmemory policy: @policy', [
'@used_memory' => $info['used_memory_human'] ?? $info['Memory']['used_memory_human'],
'@max_memory' => format_size($memory_config['maxmemory']),
@@ -180,7 +180,7 @@ class ReportController extends ControllerBase {
else {
$memory_value = $this->t('@used_memory / unlimited, maxmemory policy: @policy', [
'@used_memory' => $info['used_memory_human'] ?? $info['Memory']['used_memory_human'],
- '@policy' => $memory_config['maxmemory-policy'],
+ '@policy' => $memory_config['maxmemory-policy'] ?? NULL,
]);
}
@@ -248,7 +248,7 @@ class ReportController extends ControllerBase {
];
// Warnings/hints.
- if ($memory_config['maxmemory-policy'] == 'noeviction') {
+ if (!empty($memory_config['maxmemory-policy']) && $memory_config['maxmemory-policy'] == 'noeviction') {
$redis_url = Url::fromUri('https://redis.io/topics/lru-cache', [
'fragment' => 'eviction-policies',
'attributes' => [