woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
231 stars 202 forks source link

Uncaught TypeError class-wc-rest-stripe-account-keys-controller.php #2653

Open bgoewert opened 1 year ago

bgoewert commented 1 year ago

Unable to connect using test keys.

While opening the account keys dialog to enter test keys.

[06-Jul-2023 16:00:17 UTC] PHP Fatal error:  Uncaught TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, string given in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-stripe/includes/admin/class-wc-rest-stripe-account-keys-controller.php:106
Stack trace:
#0 /var/www/wordpress/wp-content/plugins/woocommerce-gateway-stripe/includes/admin/class-wc-rest-stripe-account-keys-controller.php(106): array_intersect_key()
#1 /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1181): WC_REST_Stripe_Account_Keys_Controller->get_account_keys()
#2 /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1028): WP_REST_Server->respond_to_request()
#3 /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php(442): WP_REST_Server->dispatch()
#4 /var/www/wordpress/wp-includes/rest-api.php(410): WP_REST_Server->serve_request()
#5 /var/www/wordpress/wp-includes/class-wp-hook.php(308): rest_api_loaded()
#6 /var/www/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#7 /var/www/wordpress/wp-includes/plugin.php(565): WP_Hook->do_action()
#8 /var/www/wordpress/wp-includes/class-wp.php(399): do_action_ref_array()
#9 /var/www/wordpress/wp-includes/class-wp.php(780): WP->parse_request()
#10 /var/www/wordpress/wp-includes/functions.php(1334): WP->main()
#11 /var/www/wordpress/wp-blog-header.php(16): wp()
#12 /var/www/wordpress/index.php(17): require('...')
#13 {main}
  thrown in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-stripe/includes/admin/class-wc-rest-stripe-account-keys-controller.php on line 106

While attempting to save test keys.

[06-Jul-2023 17:35:38 UTC] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-stripe/includes/admin/class-wc-rest-stripe-account-keys-controller.php:196
Stack trace:
#0 /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1181): WC_REST_Stripe_Account_Keys_Controller->set_account_keys()
#1 /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1028): WP_REST_Server->respond_to_request()
#2 /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php(442): WP_REST_Server->dispatch()
#3 /var/www/wordpress/wp-includes/rest-api.php(410): WP_REST_Server->serve_request()
#4 /var/www/wordpress/wp-includes/class-wp-hook.php(308): rest_api_loaded()
#5 /var/www/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#6 /var/www/wordpress/wp-includes/plugin.php(565): WP_Hook->do_action()
#7 /var/www/wordpress/wp-includes/class-wp.php(399): do_action_ref_array()
#8 /var/www/wordpress/wp-includes/class-wp.php(780): WP->parse_request()
#9 /var/www/wordpress/wp-includes/functions.php(1334): WP->main()
#10 /var/www/wordpress/wp-blog-header.php(16): wp()
#11 /var/www/wordpress/index.php(17): require('...')
#12 {main}
  thrown in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-stripe/includes/admin/class-wc-rest-stripe-account-keys-controller.php on line 196

Environment (please complete the following information):

bgoewert commented 1 year ago

Added a type declaration to line 193 and then it let me save the test keys.

$settings = (array) get_option( self::STRIPE_GATEWAY_SETTINGS_OPTION_NAME, [] );

github-actions[bot] commented 4 days ago

Hi, This issue has gone 150 days (5 months) without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest version, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.