Wrong memory percentage on /admin/reports/redis

Created on 12 January 2021, over 4 years ago
Updated 31 August 2024, 12 months ago

Problem/Motivation

        '@used_percentage' => (int) ($info['used_memory'] ?? $info['Memory']['used_memory'] / $memory_config['maxmemory'] * 100),

The origin code is interpreted to

$used_percentage;
 
if (!isset($info['used_memory'])) {
   $used_percentage = (int) ($info['Memory']['used_memory'] / $memory_config['maxmemory'] * 100)
}
else {
  $used_percentage = (int) $info['used_memory'];
}

Steps to reproduce

Proposed resolution

Add () to $info['used_memory'] ?? $info['Memory']['used_memory']

        '@used_percentage' => (int) (($info['used_memory'] ?? $info['Memory']['used_memory']) / $memory_config['maxmemory'] * 100),

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇳China jungle Chongqing, China

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024