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

Class name plugin conflict causing PHP Fatal Error - Cannot declare class Stripe\Stripe #1170

Closed
AndyGeeGit opened this issue Oct 31, 2019 · 2 comments
Labels

Comments

@AndyGeeGit
Copy link

Since v191022 all s2member Stripe payments fail at Submit Form with onscreen error:

The site is experiencing technical difficulties

and in logs:

PHP Fatal error:
Cannot declare class Stripe\Stripe, because the name is already in use in
/home/xxxx/public_html/wp-content/plugins/s2member-pro/
src/includes/classes/gateways/stripe/stripe-sdk/lib/Stripe.php
on line 11

Disabled another plugin which hadn't changed to make sure the more important s2member is now working. So yes, this is a plugin conflict, but is 'stripe' the wisest class name?

@clavaque
Copy link
Contributor

Hi Andy,

Thanks for reporting it. Yes, I'm aware of it and will put out a release soon. I've just been looking at what the best approach may be.

The Stripe SDK is distributed by Stripe, and used by many projects. So several plugins could be using it, that's why the overlap. Renaming their namespace could be complicated, because then everything that uses it has to be renamed too, and may introduce unexpected issues. I may need to just check if it's already loaded before trying to add it, but then it risks that the other copy that was loaded first, is older and outdated. I couldn't find a perfect solution, but I'm addressing it in the next release.

:)

@clavaque clavaque added the bug label Nov 14, 2019
@clavaque
Copy link
Contributor

Could you try this file? https://s2member.com/?s2member_file_download=ccaps%2Faccess-s2member-ccap-pro%2Fstripe-utilities.zip

Let me know if the error goes away for you, please.

Another thing to try, though, is a plugin manager that will let you activate or deactivate plugins depending on the page. That way you could have both plugins without conflicting, because both would not be active on the same page.

I look forward to your update. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants