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 ArgumentCountError: Too few arguments to function WC_Payments_Customer_Service::__construct() #7619

Closed
htdat opened this issue Nov 3, 2023 · 5 comments
Labels
category: core WC Payments core related issues, where it’s obvious. Component: WC Payments Extensibility Issues related to WC Payments extensibility initiative type: bug The issue is a confirmed bug.

Comments

@htdat
Copy link
Member

htdat commented Nov 3, 2023

Describe the bug

Since WooPayments 6.7.0, we noticed this error related to other plugins such as Cartflow and WPFunnels Pro.

Cartflow:

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WC_Payments_Customer_Service::__construct(), 3 passed in /srv/htdocs/wp-content/plugins/cartflows-pro/modules/gateways/class-cartflows-pro-gateway-woocommerce-payments.php on line 97 and exactly 4 expected in /srv/htdocs/wp-content/plugins/woocommerce-payments/includes/class-wc-payments-customer-service.php:82

Stack trace for Cartflow
PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function WC_Payments_Customer_Service::__construct(), 3 passed in /srv/htdocs/wp-content/plugins/cartflows-pro/modules/gateways/class-cartflows-pro-gateway-woocommerce-payments.php on line 97 and exactly 4 expected in /srv/htdocs/wp-content/plugins/woocommerce-payments/includes/class-wc-payments-customer-service.php:82
Stack trace:
#0 /srv/htdocs/wp-content/plugins/cartflows-pro/modules/gateways/class-cartflows-pro-gateway-woocommerce-payments.php(97): WC_Payments_Customer_Service->__construct(Object(WC_Payments_API_Client), Object(WC_Payments_Account), Object(WCPay\Database_Cache))
#1 /srv/htdocs/wp-content/plugins/cartflows-pro/modules/gateways/class-cartflows-pro-gateway-woocommerce-payments.php(76): Cartflows_Pro_Gateway_Woocommerce_Payments->prepare_gateway_objects()
#2 /srv/htdocs/wp-content/plugins/cartflows-pro/modules/gateways/class-cartflows-pro-gateway-woocommerce-payments.php(55): Cartflows_Pro_Gateway_Woocommerce_Payments->__construct()
#3 /srv/htdocs/wp-content/plugins/cartflows-pro/modules/gateways/class-cartflows-pro-gateway-woocommerce-payments.php(739): Cartflows_Pro_Gateway_Woocommerce_Payments::get_instance()
#4 /srv/htdocs/wp-content/plugins/cartflows-pro/classes/class-cartflows-pro-gateways.php(119): include_once('/srv/htdocs/wp-...')
#5 /srv/htdocs/wp-content/plugins/cartflows-pro/classes/class-cartflows-pro-gateways.php(94): Cartflows_Pro_Gateways->load_gateway('woocommerce_pay...')
#6 /wordpress/core/6.3.2/wp-includes/class-wp-hook.php(310): Cartflows_Pro_Gateways->load_required_integrations('')
#7 /wordpress/core/6.3.2/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
#8 /wordpress/core/6.3.2/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 /wordpress/core/6.3.2/wp-settings.php(654): do_action('wp_loaded')
#10 /srv/htdocs/wp-config.php(75): require_once('/wordpress/core...')
#11 /wordpress/core/6.3.2/wp-load.php(55): require_once('/srv/htdocs/wp-...')
#12 /wordpress/core/6.3.2/wp-blog-header.php(13): require_once('/wordpress/core...')
#13 /wordpress/core/6.3.2/index.php(17): require('/wordpress/core...')
#14 {main}
  thrown in /srv/htdocs/wp-content/plugins/woocommerce-payments/includes/class-wc-payments-customer-service.php on line 82
Stack trace for WPFunnels Pro
2023-11-02T04:42:02+00:00 CRITICAL Uncaught ArgumentCountError: Too few arguments to function WC_Payments_Customer_Service::__construct(), 3 passed in /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-woocommerce-payments.php on line 95 and exactly 4 expected in /home/public_html/wp-content/plugins/woocommerce-payments/includes/class-wc-payments-customer-service.php:82
Stack trace:
#0 /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-woocommerce-payments.php(95): WC_Payments_Customer_Service->__construct()
#1 /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-woocommerce-payments.php(73): WPFunnelsPro\Frontend\Gateways\Wpfnl_Pro_Woocommerce_Payments->prepare_objects()
#2 /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-woocommerce-payments.php(57): WPFunnelsPro\Frontend\Gateways\Wpfnl_Pro_Woocommerce_Payments->__construct()
#3 /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-woocommerce-payments.php(669): WPFunnelsPro\Frontend\Gateways\Wpfnl_Pro_Woocommerce_Payments::get_instance()
#4 /home/public_html/wp-content/plugins/ameliabooking/vendor/composer/ClassLoader.php(576): include('...')
#5 /home/public_html/wp-content/plugins/ameliabooking/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}()
#6 /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-factory.php(72): Composer\Autoload\ClassLoader->loadClass()
#7 /home/public_html/wp-content/plugins/wpfunnels-pro/public/gateways/class-wpfnl-pro-gateway-factory.php(51): WPFunnelsPro\Frontend\Modules\Gateways\Payment_Gateways_Factory->build_gateway()
#8 /home/public_html/wp-includes/class-wp-hook.php(310): WPFunnelsPro\Frontend\Modules\Gateways\Payment_Gateways_Factory->load_payment_gateway_integrations()
#9 /home/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
#10 /home/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#11 /home/public_html/wp-settings.php(654): do_action()
#12 /home/public_html/wp-config.php(103): require_once('...')
#13 /home/public_html/wp-load.php(50): require_once('...')
#14 /home/public_html/wp-blog-header.php(13): require_once('...')
#15 /home/public_html/index.php(17): require('...')
#16 {main}
  thrown in /home/public_html/wp-content/plugins/woocommerce-payments/includes/class-wc-payments-customer-service.php on line 82

Code info

#7520 updated the signature of WC_Payments_Customer_Service cc @Automattic/sigma

Additional context

@htdat htdat added type: bug The issue is a confirmed bug. Component: WC Payments Extensibility Issues related to WC Payments extensibility initiative labels Nov 3, 2023
@tpaksu
Copy link
Contributor

tpaksu commented Nov 3, 2023

Hey @htdat, thanks for the ping, but I'm not sure about the action that we need to take here. Should we revert the class constructor signature we changed, because some other plugins are using that? I assume we needed that change, and I think the plugins need to be adapted to our code, right? cc @vladolaru.

@htdat
Copy link
Member Author

htdat commented Nov 3, 2023

Hey @tpaksu, sorry for the confusion. I don't mean any action right now, this is just a "FYI".

@tpaksu
Copy link
Contributor

tpaksu commented Nov 3, 2023

Ok, thanks for the clarification.

@vladolaru
Copy link
Contributor

Oh! I introduced the Fraud_Service in all places that have fraud concerns. The WC_Payments_Customer_Service is one of them since we do fraud assessments for shoppers.

I didn't think about other extensions using this class. But yes, the solution is for extensions to catch up and update.

@htdat htdat added the category: core WC Payments core related issues, where it’s obvious. label Nov 9, 2023
@htdat
Copy link
Member Author

htdat commented Nov 9, 2023

After discussing with @Automattic/gamma during the prioritization call, we're going to close this issue. The main reason is that WC_Payments_Customer_Service is not intended to use outside of WooPayments.

In case, we have more specific requests from developers and their rationale behind, we can iterate a permanent solution for this type of issue. Right now, other plugins/extensions would update their own code to avoid this issue.

@htdat htdat closed this as completed Nov 9, 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: WC Payments Extensibility Issues related to WC Payments extensibility initiative type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

3 participants