Fatal error on undefined function is_add_payment_method_page()
-
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:
- Under what conditions is_add_payment_method_page() might not be available when ContextHandler->initialize() runs?
- Whether this is a known compatibility issue with WooCommerce 11.0.1?
Happy to provide more info as required
Thanks in advance.
You must be logged in to reply to this topic.