matomo-org / matomo-for-wordpress

Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
https://matomo.org
GNU General Public License v3.0
119 stars 25 forks source link

Critical error in Wordpress - only for Matomo plugin #618

Closed hookedbythatbook closed 2 years ago

hookedbythatbook commented 2 years ago

Hi,

I'm on Wordpress 6.0 and have been using Matomo for a few months now. I've had no issues with it until this morning. Some plugins have updated in the last few days, but I haven't added any new ones. Today I received the following message when I tried to look at the summary report on Wordpress:

There has been a critical error on this website. Please check your site admin email inbox for instructions.

All other plugins work perfectly fine.

Here is a copy of the system report:

              # Matomo

Endpoints

Crons

Matomo Settings

Logs

WordPress

WordPress Plugins

MU Plugins

Plugins

Server

Database

Browser

mattmary commented 2 years ago

Hi @hookedbythatbook

did you received an email which could give us more information regarding your issue? Do you have any details in the wordpress or php log files?

Kind regards

Mat

hookedbythatbook commented 2 years ago

Hi, yes I did. I'll have to go look for the log files. But here is the email:

Howdy!

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

In this case, WordPress caught an error with one of your plugins, Matomo Analytics - Ethical Stats. Powerful Insights..

First, visit your website (https://hookedbythatbook.com/) and check for any visible issues. Next, visit the page where the error was caught (https://hookedbythatbook.com/wp-admin/admin.php?page=matomo-summary) and check for any visible issues.

Please contact your host for assistance with investigating this issue further.

If your site appears broken and you can't access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further.

To keep your site safe, this link will expire in 1 day. Don't worry about that, though: a new link will be emailed to you if the error occurs again after it expires.

When seeking help with this issue, you may be asked for some of the following information: WordPress version 6.0 Active theme: X Blog Pro (version 1.2.9) Current plugin: Matomo Analytics - Ethical Stats. Powerful Insights. (version 4.10.0) PHP version 7.4.28

Error Details

An error of type E_COMPILE_ERROR was caused in line 210 of the file /home1/hookedb6/public_html/wp-content/plugins/matomo/app/vendor/php-di/php-di/src/Container.php. Error message: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool

hookedbythatbook commented 2 years ago

Where do I find the wordpress or php log files?

hookedbythatbook commented 2 years ago

I found this in an error log:

[14-Jun-2022 15:16:43 UTC] PHP Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /home1/hookedb6/public_html/wp-content/plugins/matomo/app/vendor/php-di/php-di/src/Container.php on line 210

It was repeated several times. Well, I guess this is the same error that was mentioned in the email that I posted earlier.

mattmary commented 2 years ago

Hi,

Thanks. I'm not able to reproduce the problem but I'm not able to install all your plugins has you may have custom and paid plugins. Which action leads to this error? Kind regards

Mat

hookedbythatbook commented 2 years ago

Only when I'm in the admin side of my wordpress page and I go down to the Matomo Analysis menu. If I click on Settings, for example, I see that error. And on most of the other options as well.

The rest of the site works fine with no issues.

mattmary commented 2 years ago

duplicate of #596

hookedbythatbook commented 2 years ago

Hi, I looked at the other post with the same issue, and I don't have any of those plugins installed. Also, the Matomo plugin worked just fine with everything I have and I didn't add any new ones.

Is it possible for me, with this error, to save my Matomo data somehow and then try to reinstall the plugin? I would prefer not to lose anything already collected.

mattmary commented 2 years ago

Hi, You won't loose your data if your uninstall and reinstall the plugin. Just make sure you uncheck the checkbox "Delete all data on uninstall" in the Matomo Analytics > Settings > Advanced tab. I thought initially it was related to a plugin conflict but my first tests let me think it's more a conflict in the matomo package management. I'm not able to reproduce it so far so I'm not quite sure why you get this error. The issue has been added to the current milestone. So it will be fixed in the next release. I'll do my best to fix it asap.

hookedbythatbook commented 2 years ago

Thanks so much! I can't access the Advanced Tab - I get the same critical error on that page. I can wait a bit.

mattmary commented 2 years ago

Hi @hookedbythatbook

Would you mind execute this shell command on your server and copy paste the result? find wp-content/plugins/ -type d -name php-di

Thanks in advance

Mat

hookedbythatbook commented 2 years ago

Hi, I need some help executing that. I'm on a WordPress site hosted on Bluehost. Where do I go to run the command?

Thanks

mattmary commented 2 years ago

Hi

do you have ssh access to your webserver? If yes, run the following commands: ssh %mywebsitehost% cd %mywordpresspath% find wp-content/plugins -type d -name php-di

if you don't have a ssh access, just run a search in your plugins directory for the name php-di.

I just want to know if you have more than one php-di folders in your plugin directory.

Kind regards

Mat

hookedbythatbook commented 2 years ago

Hi, the search found two files:

/public_html/wp-content/plugins/matomo/app/vendor/php-di

/public_html/wp-content/plugins/matomo/app/vendor/php-di/php-di

mattmary commented 2 years ago

Thank you

mattmary commented 2 years ago

Hi @hookedbythatbook

Can you do the same thing for a different file? find wp-content -type f -name ContainerInterface.php

Kind regards

Mat

hookedbythatbook commented 2 years ago

Hi,

It found the following:

/public_html/wp-content/plugins/updraftplus/vendor/aws/aws-sdk-php/src/ResponseContainerInterface.php

/public_html/wp-content/plugins/bluehost-wordpress-plugin/vendor/psr/container/src/ContainerInterface.php

/public_html/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/ContainerInterface.php

/public_html/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/ResettableContainerInterface.php

/public_html/wp-content/plugins/wordpress-seo/vendor_prefixed/psr/container/src/ContainerInterface.php

/public_html/wp-content/plugins/matomo/app/vendor/psr/container/src/ContainerInterface.php

Thank you so much!

mattmary commented 2 years ago

Hi @hookedbythatbook

Thank you. Would you mind post the content of this file /public_html/wp-content/plugins/bluehost-wordpress-plugin/vendor/psr/container/src/ContainerInterface.php please? Kind regards

Mat

hookedbythatbook commented 2 years ago

Hi, this is it:

" <?php

" namespace Psr\Container;

" use Throwable;

" /* " Base interface representing a generic exception in a container. " */ " interface ContainerExceptionInterface extends Throwable "{ "}

Thank you so much for all your effort and time. I truly appreciate it.

(I added a " at the start of each line, otherwise the code doesn't show in the message box.

mattmary commented 2 years ago

Hi @hookedbythatbook

Thanks. Are you sure this is the right content you pasted? I expect an interface called ContainerInterface, not ContainerExceptionInterface.

Kind regards

Mat

hookedbythatbook commented 2 years ago

Oh, sorry, don't know what happened. Here it is:

' <?php

declare(strict_types=1);

namespace Psr\Container;

/ ' Describes the interface of a container that exposes methods to read its entries. / interface ContainerInterface { /

Thanks.

mattmary commented 2 years ago

Hi @hookedbythatbook

Unfortunately we can't do anything for this issue: your have two two different versions of the ContainerInterface.php file (one comiing from your bluehost plugin, one in the matomo) which are incompatible in your version of PHP. Your bluehost plugin is loaded before the matomo one, and so this is the bluehost version which is loaded. We have an open issue to fix this problem, #233 but it's a huge refactoring of the plugin which is not schedule for now. Until then, If you have the opportunity to remove this bluehost plugin it would solve this issue. Maybe downgrade your php version should solve your issue too. Kind regards

Mat

mattmary commented 2 years ago

duplicate of #233

hookedbythatbook commented 2 years ago

Hi, thank you so much. I'll see what I can do and let you know if anything changes.

hookedbythatbook commented 2 years ago

Just thought I'd let you know that I ended up removing the Bluehost plugin and everything is working perfectly fine now. Thanks.