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

Fatal error while cancelling subscription #14

Closed
knit-pay opened this issue Oct 10, 2022 · 2 comments · Fixed by #24
Closed

Fatal error while cancelling subscription #14

knit-pay opened this issue Oct 10, 2022 · 2 comments · Fixed by #24
Assignees

Comments

@knit-pay
Copy link
Contributor

Hello Team

Do you have any idea about the below fatal error? I am getting this error while canceling WooCommerce subscription.

[10-Oct-2022 11:48:41 UTC] PHP Fatal error:  Uncaught Exception: DateTimeImmutable::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character in C:\xampp\htdocs\wordpress-dev\wp-content\plugins\pronamic-ideal\vendor\wp-pay-extensions\woocommerce\src\SubscriptionUpdater.php:105
Stack trace:
#0 C:\xampp\htdocs\wordpress-dev\wp-content\plugins\pronamic-ideal\vendor\wp-pay-extensions\woocommerce\src\SubscriptionUpdater.php(105): DateTimeImmutable->__construct('0', Object(DateTimeZone))
#1 C:\xampp\htdocs\wordpress-dev\wp-content\plugins\pronamic-ideal\vendor\wp-pay-extensions\woocommerce\src\SubscriptionUpdater.php(203): Pronamic\WordPress\Pay\Extensions\WooCommerce\SubscriptionUpdater->update_pronamic_subscription()
#2 C:\xampp\htdocs\wordpress-dev\wp-includes\class-wp-hook.php(309): Pronamic\WordPress\Pay\Extensions\WooCommerce\SubscriptionUpdater::maybe_update_pronamic_subscription(2810)
#3 C:\xampp\htdocs\wordpress-dev\wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#4 C:\xampp\htdocs\wordpress-dev\wp-includes\plugin.php(476): WP_Hook->do_action(Array)
#5 C:\xampp\htdocs\wordpress-dev\wp-includes\post.php(4662): do_action('save_post_shop_...', 2810, Object(WP_Post), true)
#6 C:\xampp\htdocs\wordpress-dev\wp-includes\post.php(4775): wp_insert_post(Array, false, true)
#7 C:\xampp\htdocs\wordpress-dev\wp-admin\includes\post.php(426): wp_update_post(Array)
#8 C:\xampp\htdocs\wordpress-dev\wp-admin\post.php(227): edit_post()
#9 {main}
  thrown in C:\xampp\htdocs\wordpress-dev\wp-content\plugins\pronamic-ideal\vendor\wp-pay-extensions\woocommerce\src\SubscriptionUpdater.php on line 105

@rvdsteege
Copy link
Member

Seems the WooCommerce subscription has a trial period, but the trial end date is 0?

/**
* Trial period.
*/
$trial_period = $woocommerce_subscription->get_trial_period();
if ( '' !== $trial_period ) {
$trial_end_date = new \DateTimeImmutable( $woocommerce_subscription->get_date( 'trial_end', 'gmt' ), new \DateTimeZone( 'GMT' ) );

@knit-pay
Copy link
Contributor Author

knit-pay commented Oct 10, 2022

Steps to replicate the issue

  1. Create a product with Trial period.
  2. Start the subscription.
  3. change the status of active subscription to Pending cancellation from admin panel in WooCommerce.
  4. Change the status from Pending cancellation to "Cancelled" from admin panel in WooCommerce. In this step, Fatal Error occurs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Status: Done
2 participants