Findus23 / matomo-DiagnosticsExtended

2 stars 3 forks source link

Opcache Error Spam #11

Open JE4GLE opened 1 year ago

JE4GLE commented 1 year ago

The following message is spammed 11 times on the diagnostics page and has something to do with the DiagnosticsExtended Plugin.

WARNING: /plugins/DiagnosticsExtended/Diagnostic/OpcacheCheck.php(52): Notice - Trying to access array offset on value of type null - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org/ (please do a search first as it might have been reported already) (Module: Installation, Action: getSystemCheck, In CLI mode: false)

Expected Behavior

The expected behavior is to not show the error message and fix the underlying error, if there is one.

Current Behavior

The error message is spammed 11 times.

Possible Solution

I think the message could mean that opcache is disabled and a warning message can be displayed in this case. But I’m not sure. I think the if case can be used for this: https://github.com/Findus23/matomo-DiagnosticsExtended/blob/main/Diagnostic/OpcacheCheck.php#L44

Steps to Reproduce (for Bugs)

I guess this has to do with the Opcache installation of my hosting provider. URL: /index.php?date=last7&module=Installation&format=html&action=systemCheckPage&idSite=1&period=range&showtitle=1&random=2535&activated=

  1. Open the diagnostics page
  2. Reload the page to load data from the cache

Context

I created this error based on a suggestion on this forum post: https://forum.matomo.org/t/matomo-4-3-0-spams-opcache-error-message/41895/7

This information is in the diagnostics section and I guess it is interesting: PHP Disabled functions opcache_reset, opcache_get_status

Your Environment

JE4GLE commented 1 year ago

I guess my provider disabled the opcache_get_status function, because it is a shared host. Can be detected using

$disabledList = explode(',', ini_get('disable_functions'));
$disabled = in_array('opcache_get_status', $disabledList);

I guess an error message like

It seems like OPcache is enabled in your configuration, but blocked for security reasons. OPcache stores bytecode of PHP scripts in memory and is therefore able to speed up PHP by quite a bit as it avoids loading and parsing PHP files on every request. Check the disable_functions php.ini setting for more information.

or something like that should be added to clarify to situation.