WebberZone / contextual-related-posts

Contextual Related Posts WordPress plugin
https://webberzone.com/plugins/contextual-related-posts/
38 stars 23 forks source link

Fatal Error: Conflict between WooCommerce Related Products plugin constants #202

Open dorogoff opened 3 weeks ago

dorogoff commented 3 weeks ago

I'm encountering an issue with a WooCommerce Related Products plugin where there's a conflict due to both your plugin and the other utilizing the same constant names. As a temporary workaround, I've manually renamed the constant from CRP_PLUGIN_DIR to CRPP_PLUGIN_DIR, which has allowed me to use both plugins simultaneously. However, this solution inhibits me from taking advantage of the plugin's auto-update functionality. It would be appreciated if a permanent resolution could be established that allows for the proper use of the auto-update feature. Thank you for your attention to this matter.

How to reproduce

  1. Install https://wordpress.org/plugins/wt-woocommerce-related-products/ plugin and activate it
  2. Install https://wordpress.org/plugins/contextual-related-posts/ and try to activate
  3. You will see a fatal error, wordpress can't activate a plugin
[10-Jun-2024 23:06:38 UTC] PHP Warning:  require_once(/var/www/wp.clean/wp-content/plugins/wt-woocommerce-related-productsincludes/load-freemius.php): Failed to open stream: No such file or directory in /var/www/wp.clean/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 101
[10-Jun-2024 23:06:38 UTC] PHP Fatal error:  Uncaught Error: Failed opening required '/var/www/wp.clean/wp-content/plugins/wt-woocommerce-related-productsincludes/load-freemius.php' (include_path='.:/usr/share/php') in /var/www/wp.clean/wp-content/plugins/contextual-related-posts/contextual-related-posts.php:101
Stack trace:
#0 /var/www/wp.clean/wp-admin/includes/plugin.php(2389): include_once()
#1 /var/www/wp.clean/wp-admin/includes/plugin.php(675): plugin_sandbox_scrape()
#2 /var/www/wp.clean/wp-admin/plugins.php(60): activate_plugin()
#3 {main}
  thrown in /var/www/wp.clean/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 101
ajaydsouza commented 2 days ago

@dorogoff

I had a chance to look into this and can confirm that there is a bug. This seems to be the case that they have the same constants defined as my plugin and that is causing an issue.

e.g. CRP_PLUGIN_URL, CRP_PLUGIN_DIR, etc.

Can you please flag this to them as the plugin constant seems to be when they called it custom related product and not the current name.

As a workaround, you can activate my plugin first and then theirs and it seems to work.