The following notices are shown when opening the Redis report (when using PHP7.4.11, Drupal 8.9.12, Redis 6.0):

Notice: Trying to access array offset on value of type bool in Drupal\redis\Controller\ReportController->overview() (line 172 of modules/contrib/redis/src/Controller/ReportController.php).

Drupal\redis\Controller\ReportController->overview()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Notice: Trying to access array offset on value of type bool in Drupal\redis\Controller\ReportController->overview() (line 183 of modules/contrib/redis/src/Controller/ReportController.php).

Drupal\redis\Controller\ReportController->overview()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Notice: Trying to access array offset on value of type bool in Drupal\redis\Controller\ReportController->overview() (line 251 of modules/contrib/redis/src/Controller/ReportController.php).

Drupal\redis\Controller\ReportController->overview()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Issue fork redis-3193478

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Ronald van Belzen created an issue. See original summary.

markdorison made their first commit to this issue’s fork.

markdorison’s picture

Version: 8.x-1.5 » 8.x-1.x-dev
Status: Active » Needs review
abu-zakham’s picture

Status: Needs review » Reviewed & tested by the community
thimoten’s picture

Is there a patch file for this fix? If not can you please point me to the right direction on how to generate a patch file for it?

We are having the same issue and I would like to add the patch on composer.

Thank you.

sokru’s picture

Status: Reviewed & tested by the community » Needs work

I can reproduce the issue, but setting "Needs work" since there's open threads on merge request.

alexgreyhead’s picture

StatusFileSize
new255.54 KB

@thimoten - Gitlab allows you to download patch files for merge requests by clicking "Code \/" on the MR page and then "Plain diff":

Screenshot

... which gives you:

diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php
index 9ff362a071df04340db97c0e050839f25c23536f..037e636051f15a03f71779085ccd0158c152a5eb 100755
--- 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' => [

chrisolof made their first commit to this issue’s fork.

taran2l’s picture

StatusFileSize
new1.58 KB

Attaching static patch form from the latest MR changes (for composer patching purposes)

ahmad abbad’s picture

Patch #10 Worked form me

ahmad abbad’s picture

Status: Needs work » Reviewed & tested by the community

apotek made their first commit to this issue’s fork.

apotek’s picture

> I can reproduce the issue, but setting "Needs work" since there's open threads on merge request.

Keeping this as reviewed and tested. I am not sure why gitlab says there are three unresolved threads. The "resolve thread" buttons are not visible, so while it indicates that all threads are unresolved, it appears that they actually were resolved at some point in time. In any case, all questions have been resolved with decisions or changes.

This looks good to go.

yazzbe’s picture

Patch #10 also worked form me on D10.2.0.4 (PHP 8.1.27) and redis 1.7
applied manually

programeta’s picture

Patch #10 also worked form me

Berdir made their first commit to this issue’s fork.

  • Berdir committed 3cee12eb on 8.x-1.x authored by markdorison
    Issue #3193478 by markdorison, apotek, chrisolof: Notice: Trying to...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.