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

Tests for possible fatal errors when getting order #690

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

strutalan
Copy link

@strutalan strutalan commented Sep 25, 2024

Submitting PR per support request

Description

Encountered in the wild, I found an issue where fatal PHP errors could be thrown from class-wcs-cart-renewal on line 1314 and wcs-renewal-functions on line 112.
This resulted in one customer in particular encountering a fatal error on all page requests immediately after logging in.

PHP Fatal error: Uncaught Error: Call to a member function get_fees() on bool in
/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:1314

PHP Fatal error: Uncaught Error: Call to a member function has_status() on bool in
/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/wcs-renewal-functions.php:112

The submitted change checks that an order is preset before attempting to call methods that would result in a 500 error if the order is false.

How to test this PR

How to replicate the apparent issue with a past order isn't known but suspect it was due to a manual deletion or cancellation of a past subscription via the admin.

Tested the patch live on the site which had this problem by signing in as that user, used the site as normal, no other issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant