Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent vendor conflicts with other WordPress plugins #233

Closed
tsteur opened this issue Feb 27, 2020 · 16 comments
Closed

Prevent vendor conflicts with other WordPress plugins #233

tsteur opened this issue Feb 27, 2020 · 16 comments
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. compatibility with other plugins Critical Indicates the severity of an issue is very critical and the issue has a very high priority. Enhancement For new feature suggestions that for example enhance Matomo's cabapilities..

Comments

@tsteur
Copy link
Member

tsteur commented Feb 27, 2020

See https://wordpress.org/support/topic/activation-problem-critical-db-error/#post-12489059 and #19

We have quite a few vendor dependencies meaning there's a chance that other plugins embed the same vendor dependency but an older or more recent version and they aren't compatible with ours.

Doing a quick search found eg google/site-kit-wp#612 which solved this by prefixing vendor libraries see /~https://github.com/google/site-kit-wp/pull/696/files and /~https://github.com/google/site-kit-wp/pull/735/files

To ultimately solve this problem it may be interesting to see if we can do something similar. Might be quite a bit of work that needs to be done directly in core. This will solve a lot of trouble over the years of debugging similar issues.

Can't think of a different way to solve this.

@tsteur tsteur added Enhancement For new feature suggestions that for example enhance Matomo's cabapilities.. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels Feb 27, 2020
@tsteur tsteur modified the milestones: Current sprint, Matomo 4 Feb 27, 2020
@MikeNGarrett
Copy link

Very interested in this solution.

@tsteur
Copy link
Member Author

tsteur commented Jun 3, 2020

Here's another conflict because of this with the popular WP-Optimize https://wordpress.org/support/topic/update-3-1-1-crashes-my-site/#topic-12931535-replies

@tsteur
Copy link
Member Author

tsteur commented Sep 17, 2020

also see https://developer.yoast.com/blog/safely-using-php-dependencies-in-the-wordpress-ecosystem/

it's bit too late to do this in Matomo 4 so might have to do this as part of Matomo 5

@tsteur
Copy link
Member Author

tsteur commented Dec 7, 2020

Generally this is as easy as this by the looks:

wget /~https://github.com/humbug/php-scoper/releases/download/0.13.10/php-scoper.phar
php-scoper.phar add-prefix

Then looks eg like this
image
image

(you can configure what files and namespaces etc to replace)

The problem is that this won't work actually or only for vendor libraries that only we use internally in the plugin.

I wanted to fix https://wordpress.org/support/topic/critical-error-after-upgrade/ to make the plugin work again regarding the newer PHP-DI library but already noticed while reading docs of course it can't work. That's because if if eg renames \Di\object() to \_PhpScoper7739d17947fe\Di\object() then this will work for our plugin but not for any other Matomo plugin. It's only a solution when you don't have any other plugins, or you own all plugins or only you use that vendor library and it is 100% guaranteed no other Matomo plugin won't access the vendor lib directly.

For when we do Matomo 5 we could prefix some things with Matomo like \Matomo\Di\object() and then get people to use this but it won't work any other way.

@tsteur
Copy link
Member Author

tsteur commented Dec 8, 2020

We'll look into this as part of Matomo 5.

@mattmary
Copy link
Contributor

mattmary commented Oct 20, 2022

Hello @tsteur

Here's how they proceed in the yoast SEO plugin: https://yoast.com/developer-blog/safely-using-php-dependencies-in-the-wordpress-ecosystem/
They use https://web.archive.org/web/20210412151924//~https://github.com/humbug/php-scoper

@MichaelSchober
Copy link

MichaelSchober commented May 9, 2023

As far as I saw the proper fix is planned for Matomo 5. Is there some quick fix I can do right now for this issue?
It's currently happening for me with Matomo 4.14.2.

Thanks for the awesome work!

EDIT for anybody else stumbling onto this: here is the list with incompatible plugins.

@mattmary
Copy link
Contributor

mattmary commented May 9, 2023

Hello @MichaelSchober

It's only plan for Matomo 5.x.
We are releasing the first beta soon, so it's coming.
Kind regards

Mat

@LordSimal
Copy link

Any update on this?

@eigenstil
Copy link

Any update on this?

I'm also very interested in this issue. As discussed in #618 this causes the WordPress backend to completly fail.

Background:

We have a lot of wordpress websites from our customers, where this became a problem in the last couple of days. all of these websites are now "inaccessible" in the backend. The only solution is to completly deactivate the matomo plugin (which is of course very bad, because then no more statistics are collected). Unfortunately, we can't disable the other plugins, as they are indispensable for the functioning of the websites.

@diosmosis
Copy link
Member

@eigenstil @LordSimal we are currently working on this. You can track the remaining work in the following issues: #840, #841

@macwinnie
Copy link

Hey there =)
Any christmas present or at least an estimation for us on that topic? ... would be great to get those WordPress instances back up monitored and running =)

@diosmosis
Copy link
Member

@macwinnie the remaining work involves making Matomo for WordPress work with Matomo 5, then just prefixing it and making everything work. I can't give an estimate, but it's the only thing I'm working on right now.

@schwarzpunkt
Copy link

Has the conflict between Matomo and WP Rocket been resolved with version 5.0?

@diosmosis
Copy link
Member

@schwarzpunkt WP Rocket fixed the issue on their end. In Matomo for WordPress 5.0 we're also applying the fix so conflicts with other plugins will also go away. However, there appears to be an update issue with 5.0.2 that occurs if you're using a Matomo plugin installed through the marketplace. We're hoping to have that resolved by tomorrow at the latest.

@diosmosis
Copy link
Member

Matomo for WordPress 5 prefixes some composer dependencies to prevent these types of conflicts, closing this one.

reid added a commit to AwakeningSV/wordpress that referenced this issue Feb 21, 2024
There is no longer a conflict with Matomo.
See: matomo-org/matomo-for-wordpress#233

  - Removing awakeningsv/authorizer (1.4.0)
  - Locking wpackagist-plugin/authorizer (3.6.3.1)
  - Upgrading wpackagist-plugin/matomo (4.15.3 => 5.0.4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. compatibility with other plugins Critical Indicates the severity of an issue is very critical and the issue has a very high priority. Enhancement For new feature suggestions that for example enhance Matomo's cabapilities..
Projects
None yet
Development

No branches or pull requests

10 participants