diff options
author | MichaIng <micha@dietpi.com> | 2022-01-11 15:39:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 15:39:02 +0300 |
commit | 796764aafd318cfeedf6d19af4551e846a40ac94 (patch) | |
tree | 2637c83c0ca4642dcdb082d3f6d0c210fd12db87 /apps | |
parent | c47406ad3cc1606d7357af6c32c4fa7dd0ac53a7 (diff) | |
parent | 79cdb565dc541de644c21aecda1d8bb552652042 (diff) |
Merge pull request #30533 from nextcloud/fix/avoid-zero-division
Avoid zero division in setup checks
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/lib/Controller/CheckSetupController.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 78874fd02b0..ac734e5eb78 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -492,15 +492,24 @@ Raw output $status = opcache_get_status(false); // Recommend to raise value, if more than 90% of max value is reached - if ($status['opcache_statistics']['num_cached_keys'] / $status['opcache_statistics']['max_cached_keys'] > 0.9) { + if ( + empty($status['opcache_statistics']['max_cached_keys']) || + ($status['opcache_statistics']['num_cached_keys'] / $status['opcache_statistics']['max_cached_keys'] > 0.9) + ) { $recommendations[] = 'The maximum number of OPcache keys is nearly exceeded. To assure that all scripts can be hold in cache, it is recommended to apply <code>opcache.max_accelerated_files</code> to your PHP configuration with a value higher than <code>' . ($this->iniGetWrapper->getNumeric('opcache.max_accelerated_files') ?: 'currently') . '</code>.'; } - if ($status['memory_usage']['used_memory'] / $status['memory_usage']['free_memory'] > 9) { + if ( + empty($status['memory_usage']['free_memory']) || + ($status['memory_usage']['used_memory'] / $status['memory_usage']['free_memory'] > 9) + ) { $recommendations[] = 'The OPcache buffer is nearly full. To assure that all scripts can be hold in cache, it is recommended to apply <code>opcache.memory_consumption</code> to your PHP configuration with a value higher than <code>' . ($this->iniGetWrapper->getNumeric('opcache.memory_consumption') ?: 'currently') . '</code>.'; } - if ($status['interned_strings_usage']['used_memory'] / $status['interned_strings_usage']['free_memory'] > 9) { + if ( + empty($status['interned_strings_usage']['free_memory']) || + ($status['interned_strings_usage']['used_memory'] / $status['interned_strings_usage']['free_memory'] > 9) + ) { $recommendations[] = 'The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply <code>opcache.interned_strings_buffer</code> to your PHP configuration with a value higher than <code>' . ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') ?: 'currently') . '</code>.'; } } |