Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error in Multi-Currency Storefront integration #6697

Closed
jessepearson opened this issue Jul 6, 2023 · 5 comments
Closed

Fatal error in Multi-Currency Storefront integration #6697

jessepearson opened this issue Jul 6, 2023 · 5 comments
Labels
category: core WC Payments core related issues, where it’s obvious. component: customer multi-currency Issues related to customer multi-currency project priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug.

Comments

@jessepearson
Copy link
Contributor

Describe the bug

Originally reported here: p1687948619961739-slack-C01B8KNUYSW

Unsure how to replicate this, as this should not be able to happen. The get_switcher_widget_markup method is being called, which calls the get_currency_switcher_widget method, and that is returning currency_switcher_widget as a null property. This property should only be null up to the point where the widgets_init hook is called, which is before the theme template files are called.

The only fix I can think of is to call the init_widgets method again if the currency_switcher_widget property is null when get_currency_switcher_widget is called.

PHP Fatal error:  Uncaught TypeError: spl_object_hash(): Argument #1 ($object) must be of type object, null given in /wordpress/plugins/woocommerce-payments/6.0.0/includes/multi-currency/MultiCurrency.php:451
Stack trace:
#0 /wordpress/plugins/woocommerce-payments/6.0.0/includes/multi-currency/MultiCurrency.php(451): spl_object_hash(NULL)
#1 /wordpress/plugins/woocommerce-payments/6.0.0/includes/multi-currency/StorefrontIntegration.php(77): WCPay\MultiCurrency\MultiCurrency->get_switcher_widget_markup(Array, Array)
#2 /wordpress/core/6.2.2/wp-includes/class-wp-hook.php(308): WCPay\MultiCurrency\StorefrontIntegration->modify_breadcrumb_defaults(Array)
#3 /wordpress/core/6.2.2/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#4 /wordpress/plugins/woocommerce/7.8.0/includes/wc-template-functions.php(2333): apply_filters('woocommerce_bre...', Array)
#5 /wordpress/core/6.2.2/wp-includes/class-wp-hook.php(308): woocommerce_breadcrumb('')
#6 /wordpress/core/6.2.2/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#7 /wordpress/core/6.2.2/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 /wordpress/themes/storefront/4.3.0/header.php(60): do_action('storefront_befo...')
#9 /wordpress/core/6.2.2/wp-includes/template.php(783): require_once('/wordpress/them...')
#10 /wordpress/core/6.2.2/wp-includes/template.php(718): load_template('/wordpress/them...', true, Array)
#11 /wordpress/core/6.2.2/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
#12 /wordpress/themes/storefront/4.3.0/404.php(8): get_header()
#13 /wordpress/core/6.2.2/wp-includes/template-loader.php(106): include('/wordpress/them...')
#14 /wordpress/core/6.2.2/wp-blog-header.php(19): require_once('/wordpress/core...')
#15 /wordpress/core/6.2.2/index.php(17): require('/wordpress/core...')
#16 {main}
  thrown in /wordpress/plugins/woocommerce-payments/6.0.0/includes/multi-currency/MultiCurrency.php on line 451
@jessepearson jessepearson added type: bug The issue is a confirmed bug. component: customer multi-currency Issues related to customer multi-currency project labels Jul 6, 2023
@zmaglica zmaglica added the category: core WC Payments core related issues, where it’s obvious. label Jul 7, 2023
@zmaglica
Copy link
Contributor

zmaglica commented Jul 7, 2023

This issue impacts Multi-Currency, so assigning to Sigma (based on team responsibilities) @dwainm . Assigning as part of Gamma Triage process PcreKM-yM-p2

@allie500 allie500 self-assigned this Jul 11, 2023
@allie500 allie500 added the priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. label Jul 11, 2023
@allie500 allie500 removed their assignment Jul 11, 2023
@dwainm
Copy link
Contributor

dwainm commented Jul 14, 2023

@jessepearson moving this to sprint 7 where we'll have MC as a focus.

@jessepearson
Copy link
Contributor Author

Just noting about this one that the priority is as low as it goes. We haven't seen this error again, I created the issue just in case it does crop up again. As mentioned above and in the Slack thread, the error should never happen as the widget itself should be initialized before the get_header() call ever happens in the template files.

@Rockit
Copy link

Rockit commented Jul 17, 2023

Hi

I think i might also be affected by this please advise if you believe this is also related. What I have found site loads perfect if you are logged in but if you are public the site throws a critical error. So there might be a lot of others that have not picked it up yet.

[17-Jul-2023 20:27:49 UTC] PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #1 ($key) must be a valid array offset type in /usr/www/users/mygorfrnaz/wp-content/plugins/woocommerce-payments/includes/multi-currency/Geolocation.php:56

Never mind I found the issue on my side, I needed to disable multi-currency on woocommerce payments under the advance settings when you are also using the WooCommerce Multi-currency plugin.

@dwainm
Copy link
Contributor

dwainm commented Aug 30, 2023

Closing this issue as we couldn't replicate it and there has been no other reports about it.

@dwainm dwainm closed this as completed Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: core WC Payments core related issues, where it’s obvious. component: customer multi-currency Issues related to customer multi-currency project priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

5 participants