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

Possible renewal issues when both active/inactive roles are same and object cache is in use #754

Open
kaushikasomaiya opened this issue Dec 28, 2024 · 2 comments
Labels
type: bug The issue is a confirmed bug.

Comments

@kaushikasomaiya
Copy link

kaushikasomaiya commented Dec 28, 2024

9181793-zen

I haven't been able to replicate this on my own site with memcache set on localhost.

Merchant is using Subs + APFS and site is hosted on Site ground with Memcache enabled.

The renewals were getting generated with pending status but not being charged via Square CC. No order notes on the renewal order.

Upon investigating, it came out that

  • Both active / inactive role were set to "customer"
  • Subs goes on hold -> triggers role change
  • It removes the old role "customer"
  • When it attempts to assign back the same role, the object cache throws same value here and no DB update occur causing the user to stay with no role set

/wp-includes/meta.php (line 240 around)

	// Compare existing value to new value if no prev value given and the key exists only once.
	if ( empty( $prev_value ) ) {
		$old_value = get_metadata_raw( $meta_type, $object_id, $meta_key );
		if ( is_countable( $old_value ) && count( $old_value ) === 1 ) {
			if ( $old_value[0] === $meta_value ) {
				return false;
			}
		}
	}
  • further it occurs that woocommerce_scheduled_subscription_payment_square_credit_card is not being fired at all.
  • At this point I am not sure if the role issue could be affecting things further. I did not spot any sort of PHP error and the SA finishes successfully making me suspect either the role issue is halting the renewal or something else causes the gateway_scheduled_subscription_payment() function to exit silently due to memcache enabled.

Disabling the memcache on Siteground seems to have fixed both issues - role being unset and renewal halting silently

@kaushikasomaiya kaushikasomaiya added the type: bug The issue is a confirmed bug. label Dec 28, 2024
@kaushikasomaiya
Copy link
Author

It appears that this occurs on specific cache setup on SiteGround + Avada theme active.

@kaushikasomaiya
Copy link
Author

After the first DB update (role removal) there's wp_cache_delete run immediately to wipe off everything so not sure if update_meta_cache() is doing something in /wp-includes/meta.php causing an incorrect old value to be returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

1 participant