Mobile App Refresh Campaign [Banner] 2024

Product Icon

Conditional Shipping and Payments

by  Woo
Use conditional logic to restrict the shipping and payment options available on your store.

Feedback: A blank entry in the shipping restrictions causes an error and CPU race condition

A hosting client took down an entire server today because they had an extra “|” on the end of their shipping restrictions list in effect creating a blank entry.

The error in the logs was
PHP Warning: strpos(): Empty needle in /public_html/wp-content/plugins/woocommerce-conditional-shipping-and-payments/includes/restrictions/class-wc-csp-restrict-shipping-methods.php on line 712

This seemed to cause a CPU race condition and the client opening multiple orders at once in multiple tabs caused a 12-core server to stop responding.

The fix is to trim the array before processing so the needle is not empty – or clean the input on save.

Thanks!

Author

H van der Nol

Current Status

Open

Last updated: February 13, 2023

0 comments

Log in to comment on this feature request.