Problem/Motivation
We get this error on one of our servers:
[Mon Dec 11 18:55:15.244348 2023] [proxy_fcgi:error] [pid 2539467:tid 140566251677376] [client 127.0.0.1:56878] AH01071: Got error 'PHP message: Uncaught PHP Exception DivisionByZeroError: "Division by zero" at /home/insite/test/sites/insite-drupal-main/web/modules/contrib/cache_utility/src/Form/SettingsForm.php line 763'
Steps to reproduce
This seems to happen when opcache.file_cache_only is enabled.
opcache_get_status() then returns this:
array(3) {
["opcache_enabled"]=>
bool(false)
["file_cache"]=>
string(29) "/home/insite/php-opcache-cli/"
["file_cache_only"]=>
bool(true)
}
Proposed resolution
SettingsForm::getOPCacheDisplayInfo() should check if $status['opcache_statistics'] exists before trying to use it.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3407992-4.patch | 1.56 KB | sakthi_dev |
| #4 | cache_utility.png | 121.82 KB | sakthi_dev |
| #2 | Issues-3407992-Division-by-zero-error-fixes.patch | 584 bytes | viren18febs |
Issue fork cache_utility-3407992
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
Comment #2
viren18febs commentedHi @prudloff
I have added a patch, please review.
Thanks
Comment #3
prudloff commentedI don't think
$statusexists outsidegetOPCacheDisplayInfo().Comment #4
sakthi_dev commentedAddressed the comment #3. Please review. I don't have much knowledge on this project but updated the code and it's working properly for me.
Comment #5
cyoun commentedThis issue was resolved in version 1.2.0
Comment #6
cyoun commented