freemius-php-sdk icon indicating copy to clipboard operation
freemius-php-sdk copied to clipboard

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

Open alanef opened this issue 5 years ago • 14 comments

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 avatar Feb 01 '20 10:02 alanef

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

alanef avatar Feb 01 '20 11:02 alanef

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 avatar Feb 01 '20 17:02 alanef

I just encountered this too

mnelson4 avatar Jan 17 '21 06:01 mnelson4

Same here!

juanobrach avatar Mar 12 '21 14:03 juanobrach

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

sushmak02 avatar Nov 03 '21 13:11 sushmak02

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

mnelson4 avatar Nov 03 '21 15:11 mnelson4

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.)

mnelson4 avatar Nov 03 '21 15:11 mnelson4

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

alanef avatar Nov 03 '21 16:11 alanef

Just encountered this too

polevaultweb avatar Mar 11 '22 11:03 polevaultweb

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

alanef avatar Mar 11 '22 11:03 alanef

Same problem, Any solution?

selimmw avatar Jul 28 '22 06:07 selimmw

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

alanef avatar Jul 28 '22 10:07 alanef

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

selimmw avatar Jul 31 '22 06:07 selimmw

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.

alanef avatar Jul 31 '22 07:07 alanef