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

Uncaught TypeError in add-on eea-stripe-gateway when trying to make a payment #3682

Closed
christophhapple opened this issue Jan 20, 2022 · 5 comments

Comments

@christophhapple
Copy link

christophhapple commented Jan 20, 2022

Describe the bug

Dear EE team,

Let me apologize in advance for posting this issue in event-espresso-core, but the repositiory for eea-stripe-gateway doesn't seem to exist.

I could not find the correct repository for this addon: https://eventespresso.com/product/eea-stripe-gateway/

Thus, a bug report in core:

When trying to make a payment, a call to /admin-ajax.php is made, returning a 5XX status.

Looking at PHP Logs reveals the following error:

PHP Fatal error:  Uncaught TypeError: array_key_exists(): 
Argument #2 ($array) must be of type array, EE_Stripe_6_35_1\Util\CaseInsensitiveArray given 
in /.../eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiRequestor.php:402

This seems to use an outdated version of this library: https://github.com/stripe/stripe-php

I'm assuming this only became a problem with PHP 8, since array_key_exists stopped also accepting objects for the array parameter.

Even so, this leaves me in a bit of disbelief: Is no one else using EE with Stripe Gateway and PHP 8? Is the Stripe Gateway deprecated?

Thanks in adance!
Cheers,
Chris

To Reproduce

Setup Wordpress on a Server using PHP 8, install the current core and add-on, try to purchase an event ticket.

Expected behavior

Ajax call returns something successful and payment goes through.

Screenshots

N/A

Environment:

  • Version of Event Espresso: 4.10.24.p
  • Version of Event Espresso - Stripe Payment Gateway: 1.1.10.p
  • Version of WordPress: 5.8.2
  • Browser: Google Chrome Version 97.0.4692.99 (Official Build) (x86_64)
  • PHP Version: 8.0.10

Additional context

Full stack trace:

[20-Jan-2022 12:40:40 UTC] PHP Fatal error:  Uncaught TypeError: array_key_exists(): 
Argument #2 ($array) must be of type array, EE_Stripe_6_35_1\Util\CaseInsensitiveArray given 
in /eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiRequestor.php:402

Stack trace:
#0 /eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiRequestor.php(402): array_key_exists('request-id', Object(EE_Stripe_6_35_1\Util\CaseInsensitiveArray))
#1 /eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiRequestor.php(125): EE_Stripe_6_35_1\ApiRequestor->_requestRaw('post', '/v1/payment_int...', Array, Array)
#2 /eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiOperations/Request.php(57): EE_Stripe_6_35_1\ApiRequestor->request('post', '/v1/payment_int...', Array, Array)
#3 /eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiOperations/Create.php(23): EE_Stripe_6_35_1\ApiResource::_staticRequest('post', '/v1/payment_int...', Array, NULL)
#4 /eea-stripe-gateway/payment_methods/Stripe_Onsite/EEG_Stripe_Onsite.gateway.php(128): EE_Stripe_6_35_1\PaymentIntent::create(Array)
#5 /eea-stripe-gateway/payment_methods/Stripe_Onsite/EEG_Stripe_Onsite.gateway.php(82): EEG_Stripe_Onsite->doDirectPaymentWithPaymentIntents(Object(EE_Payment), Object(EE_Transaction), Array)
#6 /core/libraries/payment_methods/EE_PMT_Base.lib.php(435): EEG_Stripe_Onsite->do_direct_payment(Object(EE_Payment), Array)
#7 /core/EE_Payment_Processor.core.php(127): EE_PMT_Base->process_payment(Object(EE_Transaction), 110, Object(EventEspresso\Stripe\forms\ElementsBillingForm), 'https://swiss-r...', 'https://swiss-r...', 'CART', false)
#8 /modules/single_page_checkout/reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php(2271): EE_Payment_Processor->process_payment(Object(EE_Payment_Method), Object(EE_Transaction), 110, Object(EventEspresso\Stripe\forms\ElementsBillingForm), 'https://swiss-r...', 'CART', false, true, 'https://swiss-r...')
#9 /modules/single_page_checkout/reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php(1893): EE_SPCO_Reg_Step_Payment_Options->_attempt_payment(Object(EE_Payment_Method))
#10 /modules/single_page_checkout/reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php(1749): EE_SPCO_Reg_Step_Payment_Options->_process_payment()
#11 /modules/single_page_checkout/EED_Single_Page_Checkout.module.php(1331): EE_SPCO_Reg_Step_Payment_Options->process_reg_step()
#12 /modules/single_page_checkout/EED_Single_Page_Checkout.module.php(491): EED_Single_Page_Checkout->_process_form_action()
#13 /modules/single_page_checkout/EED_Single_Page_Checkout.module.php(146): EED_Single_Page_Checkout->_initialize()
#14 /modules/single_page_checkout/EED_Single_Page_Checkout.module.php(170): EED_Single_Page_Checkout::process_ajax_request('process_reg_ste...')
#15 /wp-includes/class-wp-hook.php(303): EED_Single_Page_Checkout::process_reg_step('')
#16 /wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#17 /wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#18 /wp-admin/admin-ajax.php(187): do_action('wp_ajax_process...')
#19 /Users/christophhapple/.composer/vendor/laravel/valet/server.php(235): require('/Users/christop...')
#20 {main}
thrown in /eea-stripe-gateway/includes/stripe-php-6.35.1/lib/ApiRequestor.php on line 402
@tn3rb
Copy link
Member

tn3rb commented Jan 25, 2022

Thanks @christophhapple

Sorry for the delay, we're currently a little understaffed. You're kinda correct that there is no repo for the Stripe gateway because it is private.

I'll get someone to look into this issue

@rubas
Copy link

rubas commented Feb 22, 2022

@tn3rb Is this now fixed? This issue is blocking our PHP 8 upgrade path.

@hoseinrafiei hoseinrafiei assigned tn3rb and unassigned hoseinrafiei Feb 22, 2022
@tn3rb
Copy link
Member

tn3rb commented Feb 22, 2022

The fix was applied to the Stripe add-on as the issue was not in core and it looks like Version 1.1.11.p included that fix and was released on February 2, 2022. Going to confirm with others just to be sure.

@tn3rb
Copy link
Member

tn3rb commented Feb 22, 2022

Just confirmed that the fix IS indeed in the 1.1.11.p version of Stripe that was released on February 2, 2022.

@tn3rb
Copy link
Member

tn3rb commented Mar 24, 2022

going to close this since the fix was released and there has been no response in over a month

@tn3rb tn3rb closed this as completed Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants