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

Conflict if used in a WordPress site where another plugin has activated freemius wordpress sdk #14

Open
alanef opened this issue Feb 1, 2020 · 14 comments

Comments

@alanef
Copy link

alanef commented Feb 1, 2020

If used in a wordpress site that has active plugins that use freemius wordpress-sdk there is a conflict

[17-Jan-2020 14:11:11 UTC] PHP Fatal error: Cannot make non static method Freemius_Api_Base::Test() static in class Freemius_Api_WordPress in /home/badlywi
red/public_html/wp-content/plugins/fullworks-anti-spam-pro/includes/vendor/freemius/wordpress-sdk/includes/sdk/FreemiusWordPress.php on line 704
[17-Jan-2020 14:11:11 UTC] PHP Stack trace:
[17-Jan-2020 14:11:11 UTC] PHP 1. {main}() /home/mydomain/public_html/wp-admin/plugins.php:0
[17-Jan-2020 14:11:11 UTC] PHP 2. require_once() /home/mydomain/public_html/wp-admin/plugins.php:10
[17-Jan-2020 14:11:11 UTC] PHP 3. do_action() /home/mydomain/public_html/wp-admin/admin.php:367
[17-Jan-2020 14:11:11 UTC] PHP 4. WP_Hook->do_action() /home/mydomain/public_html/wp-includes/plugin.php:478
[17-Jan-2020 14:11:11 UTC] PHP 5. WP_Hook->apply_filters() /home/mydomain/public_html/wp-includes/class-wp-hook.php:312
[17-Jan-2020 14:11:11 UTC] PHP 6. wp_update_plugins() /home/mydomain/public_html/wp-includes/class-wp-hook.php:288
[17-Jan-2020 14:11:11 UTC] PHP 7. set_site_transient() /home/mydomain/public_html/wp-includes/update.php:334
[17-Jan-2020 14:11:11 UTC] PHP 8. apply_filters() /home/mydomain/public_html/wp-includes/option.php:1832
[17-Jan-2020 14:11:11 UTC] PHP 9. WP_Hook->apply_filters() /home/mydomain/public_html/wp-includes/plugin.php:206
[17-Jan-2020 14:11:11 UTC] PHP 10. FS_Plugin_Updater->pre_set_site_transient_update_plugins_filter() /home/mydomain/public_html/wp-includes/class-wp-hook
.php:290
[17-Jan-2020 14:11:11 UTC] PHP 11. Freemius->get_update() /home/mydomain/public_html/wp-content/plugins/fullworks-anti-spam-pro/includes/vendor/freemius/
wordpress-sdk/includes/class-fs-plugin-updater.php:517
[17-Jan-2020 14:11:11 UTC] PHP 12. Freemius->check_updates() /home/mydomain/public_html/wp-content/plugins/fullworks-anti-spam-pro/includes/vendor/freemi
us/wordpress-sdk/includes/class-freemius.php:18962
[17-Jan-2020 14:11:11 UTC] PHP 13. Freemius->_fetch_newer_version() /home/mydomain/public_html/wp-content/plugins/fullworks-anti-spam-pro/includes/vendor
/freemius/wordpress-sdk/includes/class-freemius.php:20514
[17-Jan-2020 14:11:11 UTC] PHP 14. Freemius->_fetch_latest_version() /home/mydomain/public_html/wp-content/plugins/fullworks-anti-spam-pro/includes/vendo
r/freemius/wordpress-sdk/includes/class-freemius.php:18917
[17-Jan-2020 14:11:11 UTC] PHP 15. Freemius->get_api_site_or_plugin_scope() /home/mydomain/public_html/wp-content/plugins/fullworks-anti-spam-pro/include
s/vendor/freemius/wordpress-sdk/includes/class-freemius.php:20358
[17-Jan-2020 14:11:11 UTC] PHP 16. Freemius->get_api_site_scope() /home/mydomain/public_html/wp-content/plugins/fullworks-anti-spam-pro/includes/vendor/f
reemius/wordpress-sdk/includes/class-freemius.php:21644

@alanef
Copy link
Author

alanef commented Feb 1, 2020

I'll close this - it was actually a conflict with another plugin using Freemius API - needed to check class

@alanef alanef closed this as completed Feb 1, 2020
@alanef
Copy link
Author

alanef commented Feb 1, 2020

I will re open - as it is an incompatibility betweem php-sdk and wordpress-sdk

The Freemius_Api_Base differs between SDks as in php-sdk it has a method Test but in wordpress-sdk the base classes doesnt not have a method Test - but the class Freemius_Api_WordPres extends Freemius_Api_Base with a static method Test

Ideally Freemius_Api_Base should be the same in both libraries and the Test extended in a simplar way.

@alanef alanef reopened this Feb 1, 2020
@mnelson4
Copy link

I just encountered this too

@juanobrach
Copy link

Same here!

@sushmak02
Copy link

I am facing the same issue! Is there any fix available for this?

@mnelson4
Copy link

mnelson4 commented Nov 3, 2021

My workaround was to edit the code in the Freemius PHP SDK so it was namespaced

@mnelson4
Copy link

mnelson4 commented Nov 3, 2021

And actually, I didn’t do those changes myself. Leo from Freemius did it and sent me the modified copy. If you ask Freemius support they can send you that copy (or maybe they’ll see this is a more general issue that merits fixing more permanently.)

@alanef
Copy link
Author

alanef commented Nov 3, 2021

A better solution to name space - perhaps if should just be updated in the library here?

@polevaultweb
Copy link

Just encountered this too

@alanef
Copy link
Author

alanef commented Mar 11, 2022

Yes this library is unsafe to use in a wordpress site, plugin or theme - should use the WordPress SDK instead.

I only use this library on non WordPress apps where I want to access freemius data

@selimmw
Copy link

selimmw commented Jul 28, 2022

Same problem, Any solution?

@alanef
Copy link
Author

alanef commented Jul 28, 2022

The solution is not to use this library in WordPress use this https://github.com/Freemius/wordpress-sdk instead

@selimmw
Copy link

selimmw commented Jul 31, 2022

Hi @alanef Just tested the same result, what should I do now?

@alanef
Copy link
Author

alanef commented Jul 31, 2022

I don't understand what you mean. If you are not using the library in WP then you can't get the message. Have you gone through the normal steps of debugging / searching? In any case a mentioned don't use the library in WP, which means don't use any plugin or theme that incorrectly loads the library.

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

No branches or pull requests

6 participants