Support » Plugin: WooCommerce Stripe Payment Gateway » Version 4.5.4 Conflict

  • Resolved mr.clayton

    (@mrclayton)


    Hi Support Team,

    In version 4.5.4 it looks like a new function wc_stripe was added. This function name conflicts with a function of the same name in my plugin, Stripe For WooCommerce.

    It’s fairly common for merchants to have this plugin and Stripe For WooCommerce active at the same time but with the release of 4.5.4, the name clash causes an exception.

    Can the development team take a look at renaming this new function to ensure there isn’t a conflict between the two?

    Kind Regards,

Viewing 9 replies - 1 through 9 (of 9 total)
  • MikeCooter

    (@mikecooter)

    Is this likely to cause a critical error? Since updating Stripe from 4.5.3 > 4.5.4, every attempt to edit a page gives a critical error.

    I’ve just applied the 4.5.5 update, but no change. Currently launching debugging to find the problem.

    Thanks.

    • This reply was modified 2 months ago by MikeCooter. Reason: Wanted to enable notifications
    mr.clayton

    (@mrclayton)

    Hi @mikecooter,

    If you have Stripe For WooCommerce active and this plugin active then yes it will cause a critical error because of the function name conflict introduced in version 4.5.4 of this plugin.

    Here is how you can troubleshoot:

    1. Navigate to your control panel where you can view your WordPress Directory
    2. Navigate to wp-content/plugins.
    3. If you see a folder named woocommerce-stripe-gateway and woo-stripe-gateway that means you probably have both Stripe plugins enabled.
    4. You can rename one of the directories. Example woocommerce-stripe-gateway_. The underscore in the name will prevent it from being loaded by WordPress.
    5. You can then navigate to the WooCommerce > Status > Logs page and review the failure log entries to confirm.

    Kind Regards,

    MikeCooter

    (@mikecooter)

    Thanks, Mr Clayton.

    Still receiving critical errors – just received FTP credentials so will use your advice.

    Thank you.

    • This reply was modified 2 months ago by MikeCooter. Reason: Got FTP login
    thejasonator

    (@thejasonator)

    I got a message this morning from one of my staff that she couldn’t log into our website.
    I immediately investigated and found 705 of these:
    [17-Nov-2020 02:12:53 UTC] PHP Fatal error: Cannot redeclare wc_stripe() (previously declared in /usr/local/lsws/vhost1/htdocs/wp-content/plugins/woo-stripe-payment/includes/class-stripe.php:340) in /usr/local/lsws/vhost1/htdocs/wp-content/plugins/woocommerce-gateway-stripe/woocommerce-gateway-stripe.php on line 57

    So, clearly the WooCommerce Stripe Payment Gateway author has arrogantly stomped all over the namespace of the Stripe for WooCommerce plugin. Now that WordPress performs automatic updates, plugin authors should be especially careful to respect the namespace around them, especially when the plugin is an official WooCommerce one!

    4.5.5 – 2020-11-17
    Fix – Guard against fatal errors that may occur on inbox data store load.

    It should also include

    Break – Break websites by declaring or renaming function wc_stripe()

    We were just testing the Stripe for WooCommerce plugin, as it enables Cardholder Not Present payments through the admin order screen, but since this incident we have completed the testing and have uninstalled the WooCommerce Stripe Payment Gateway plugin and will not be using it again.

    Instead, we recommend Stripe for WooCommerce, which you can get free from the WordPress plugins directory.

    Plugin Support Three Sons

    (@3sonsdevelopment)

    Hello @mrclayton,

    Thanks for bringing this up. I would suggest opening an issue on the GitHub repository to get this in front of the developers. They’d be the ones to make any code changes.

    https://github.com/woocommerce/woocommerce-gateway-stripe/issues

    Also, it’s a great idea to have a unique prefix for functions that’s specific to the company and plugin. That helps prevent conflicts like this from happening. Starting a function or class with wc_ has a pretty good chance of eventually conflicting with something like this one did.

    mr.clayton

    (@mrclayton)

    Hi @3sonsdevelopment,

    I have created a GitHub issue which can be tracked here:

    https://github.com/woocommerce/woocommerce-gateway-stripe/issues/1375

    Kind Regards,

    Plugin Support Joey Ricketts

    (@jricketts4)

    Thank you @mrclayton – Since the issue is now the source of any new information pertaining to this problem, I’m going to set this to resolved.

    Anyone else with this same problem can take a look at the issue filed above: https://github.com/woocommerce/woocommerce-gateway-stripe/issues/1375

    Thank you!
    – Joey

    thejasonator

    (@thejasonator)

    Also, it’s a great idea to have a unique prefix for functions that’s specific to the company and plugin. That helps prevent conflicts like this from happening. Starting a function or class with wc_ has a pretty good chance of eventually conflicting with something like this one did.

    That’s a bit like America discovering a new island and calling it England, then blaming England (which had the name first), and calling England the fake news media, saying England is very, very bad – sad face, and saying all the maps which already exist are fake.

    You kind of have a point, though, but if you are going to create a unique namespace for your plugin, it should be wcspg_ obvs!

    Can the development team take a look at renaming this new function to ensure there isn’t a conflict between the two?

    In the interests of even-handedness, the Stripe for WooCommerce plugin should at the same time change its prefix to s4wc_ or pps4wc_

    mr.clayton

    (@mrclayton)

    Hi All,

    I just released version 3.2.8 of Stripe For WooCommerce where the function name was changed to stripe_wc. I didn’t get a response on the GitHub issue I created so I decided to take action on my end.

    A check was added so that if a version of this plugin prior to 4.5.4 is active, my plugin’s wc_stripe function will load. That will ensure any custom code written that references wc_stripe will continue to work.

    Kind Regards,

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.