• Resolved GDU

    (@gettingdownunder)


    Hi,

    I’m getting a fatal error triggered on every page load, not just checkout, which is causing a 500 error on unrelated pages of my site (in my case, a custom job alerts page).

    Environment: WooCommerce 11.0.1, PHP 8.3.33

    The error from my debug log:

    PHP Fatal error: Uncaught Error: Call to undefined function PaymentPlugins\Stripe\is_add_payment_method_page() in wp-content/plugins/woo-stripe-payment/src/ContextHandler.php:92
    Stack trace: 0 wp-includes/class-wp-hook.php(353): PaymentPlugins\Stripe\ContextHandler->initialize() 1 wp-includes/class-wp-hook.php(377): WP_Hook->apply_filters() 2 wp-includes/plugin.php(571): WP_Hook->do_action() 3 wp-includes/class-wp.php(838): do_action_ref_array() 4 wp-includes/functions.php(1352): WP->main() 5 wp-blog-header.php(16): wp() 6 index.php(17): require()

    Since ContextHandler->initialize() is hooked into an action that fires on every front end page load, the fatal error crashes any page, not just WooCommerce pages.

    I checked the plugin files directly and is_add_payment_method_page() is called across several files (ContextHandler.php, RequestContext.php, LinkIntegration.php, wc-stripe-functions.php, and a couple of the gateway classes), but I could not find it defined anywhere within the plugin itself. It looks like it is expected to fall back to WooCommerce core’s conditional tag of the same name in the global namespace.

    I am currently using Freesoul Deactivate Plugins to deactivate Woo Stripe Payment Gateway specifically on the affected page as a workaround, which does resolve the crash there.

    Could you let me know:

    1. Under what conditions is_add_payment_method_page() might not be available when ContextHandler->initialize() runs?
    2. Whether this is a known compatibility issue with WooCommerce 11.0.1?

    Happy to provide more info as required

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Clayton R

    (@mrclayton)

    Hi @gettingdownunder

    Thank you for contacting Payment Plugins. The function is_add_payment_method_page is part of WooCommerce core and has been for a very long time so it definitely exists in version 11.0.1 which you are using.

    The ContextHandler::initialize method is called when the wp action triggers. WooCommerce loads the includes/wc-conditional-functions.php file, which defines is_add_payment_method_page right when the WooCommerce plugin file is loaded which is before the wp, init and plugins_loaded actions . That means that the function should be defined unless something on your site is causing actions to trigger out of the normal order or something is skipping the loading of WooCommerce.

    Kind Regards

    Plugin Author Clayton R

    (@mrclayton)

    Hi @gettingdownunder

    Following up on this request.

    Kind Regards

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.