WC-Local-Pickup/woocommerce-local-pickup-time

PHP Fatal error When `shipping_method_add_rate_pickup_time_args()` is called

Closed this issue · 1 comments

Describe the bug
In debug logs a PHP Fatal error is being reported when the woocommerce_shipping_method_add_rate_args filter is calling shipping_method_add_rate_pickup_time_args(), with the following trace:

PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Local_Pickup_Time_Admin::shipping_method_add_rate_pickup_time_args(), 1 passed in wp-includes/class-wp-hook.php on line 309 and exactly 2 expected in wp-content/plugins/woocommerce-local-pickup-time-select/admin/class-local-pickup-time-admin.php:488
Stack trace:
#0 wp-includes/class-wp-hook.php(309): Local_Pickup_Time_Admin->shipping_method_add_rate_pickup_time_args()
#1 wp-includes/plugin.php(189): WP_Hook->apply_filters()
#2 wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php(267): apply_filters()
#3 wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php(207): WC_Shipping_Method->add_rate()
#4 wp-content/plugins/woocommerce-local-pickup-time-select/admin/class-local-pickup-time-admin.php on line 488

To Reproduce
Steps to reproduce the behavior:
It's not clear on what is triggering this however it may be related to a bad call by one of the following plugins that a user has installed on their site and were installed in the testing environment in order to try to reproduce the cause of a possible 500 error on their site.

  • Advanced Dynamic Pricing for WooCommerce
  • Advanced Local Pickup for WooCommerce
  • Advanced Order Export For WooCommerce
  • Custom Product Tabs for WooCommerce
  • Disable Bloat for WordPress & WooCommerce
  • Discount and regular price cart and checkout page display WooCommerce
  • PW WooCommerce Gift Cards
  • Sales Report Email for WooCommerce
  • Stock Manager for WooCommerce
  • StoreCustomizer
  • WooCommerce Cart Abandonment Recovery
  • WooCommerce PDF Invoices & Packing Slips
  • WooCommerce Stripe Gateway
  • YITH WooCommerce Badge Management
  • YITH WooCommerce Wishlist

WordPress Environment

  • PHP Version: 7.4
  • WordPress Version: 5.9.3
  • WooCommerce Version: 6.5.1
  • Plugin Version: 1.4.0

After further testing the issue couldn't be reproduced simply with adding and using the plugins listed. However, there was some condition, whether it was with WooCommerece 6.4.1 or 6.5.1 where depending on how the Shipping Zones were setup the PHP Fatal Error was triggered. It was still difficult to consistently reproduce.