Matomo 4.3.0 spams Opcache error message

Sometimes, some pages I open on the Matomo dashboard have 11 warning banners at the top with the following message:

WARNING: /var/www/vhosts/h149549.web219.dogado.net/httpdocs/matomo/plugins/DiagnosticsExtended/Diagnostic/OpcacheCheck.php(51): Warning - opcache_get_status() has been disabled for security reasons - Matomo 4.3.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: systemCheckPage, In CLI mode: false)

The line numbers between OpcacheCheck.php(xx) include 51, 52, 53, 54, 58, 59, 60, 61, 62 and 63

Unfortunately, I can’t reproduce the error every time or recognize a pattern.

Hi,

This error message doesn’t come from Matomo, but instead from my plugin (DiagnosticsExtended).

I use opcache_get_status() to check the status of your OPcache setup in the system check.
But apparently in your setup even calling that function is disallowed and causes the warning.

I just released 0.1.5 of that plugin which should avoid this warning.

Thanks for the quick fix and excuse my late response!
I get another error, which might be related to this one:
WARNING: /…/matomo/plugins/DiagnosticsExtended/Diagnostic/OpcacheCheck.php(52): Notice - Trying to access array offset on value of type null - Matomo 4.4.1 - 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)

Hi Lukas,

Just to inform you that I get 10 warnings like these when I go to ‘Users’

WARNING: /plugins/DiagnosticsExtended/Diagnostic/OpcacheCheck.php(52): Notice - Trying to access array offset on value of type null - Matomo 4.7.1 - 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)

Kind regards

That weirdly enough means that you have opcache enabled on your server

but opcache_get_status() is not able to get any data.

I could handle this case, but unfortunatly don’t have the time for it right now.

Hey,

Wanted to report that this error message is still spammed 11 times in 4.11.0

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)

A fix would be very nice!
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.

Best regards

Hi @Promatur ,
Maybe you could rise an issue to the Matomo GitHub:

Could you try replacing

if (!Utils::booleanIni("opcache.enable")) {

with

if (!Utils::booleanIni("opcache.enable") || !opcache_get_status()) {

? (That also isn’t a proper fix as it will then return that opcache is disabled even though it is enabled in your setup and just the status doesn’t work)

I don’t have access to a Matomo setup at the moment, so I can only guess. But it seems still weird that your PHP responds that opcache is enabled, but at the same time refuses to give any status about opcache.

I reduced the error message to one single error, but I guess this also explains the cause of the error

WARNING: /plugins/DiagnosticsExtended/Diagnostic/OpcacheCheck.php(44): Warning - opcache_get_status() has been disabled for security reasons - Matomo 4.11.0 - Please report this message in the Matomo forums (please do a search first as it might have been reported already) (Module: Installation, Action: getSystemCheck, In CLI mode: false)

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

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

It is a very special use case, but it is one :smiley:. I guess an error message like “opcache is enabled in your configuration, but blocked for security reasons” or something like that could work.

1 Like

Ah, that explains it.

I really can’t promise that I get around to fixing that soon as I am currently traveling.

In the meantime you could change it to !@opcache_get_status() which should remove the warning.

2 Likes

Don’t worry! I created an issue on GitHub, for when you come back.
The error message is gone for now :relieved:

2 Likes