Skip to content

pr: [Nightly Fix] - Bug - Use gmdate() for Subscription Transaction Timestamps#59

Open
jewel-claw wants to merge 1 commit into
masterfrom
nightly-fix/use-gmdate-for-subscription-transaction-timestamps
Open

pr: [Nightly Fix] - Bug - Use gmdate() for Subscription Transaction Timestamps#59
jewel-claw wants to merge 1 commit into
masterfrom
nightly-fix/use-gmdate-for-subscription-transaction-timestamps

Conversation

@jewel-claw

Copy link
Copy Markdown

Summary

PaymentSuccessHandler::processSubscriptionsSuccess() used PHP's date() function to format the Stripe invoice's created Unix timestamp for the created_at and updated_at fields.

date() applies the server's local timezone. Every other timestamp derived from Stripe event data in this codebase uses gmdate() (UTC):

  • StripeHandler::handleInlineSubscriptions(): gmdate('Y-m-d H:i:s', ...)
  • PaymentSuccessHandler::processOnetimeSuccess(): gmdate('Y-m-d H:i:s', ...)

Effect: On a server configured with a non-UTC timezone (e.g., Asia/Dhaka at UTC+6), subscription transaction timestamps would be stored 6 hours ahead of UTC — inconsistent with all other Stripe-derived timestamps in the same wpf_subscription_transactions table.

Fix: Replace date() with gmdate() to match the rest of the codebase.

…imestamps

PaymentSuccessHandler::processSubscriptionsSuccess() used date() to format
the Stripe invoice timestamp for created_at/updated_at fields. date() applies
the server's local timezone, while the rest of the codebase consistently uses
gmdate() (UTC) for Stripe-sourced timestamps and current_time('mysql') for
WordPress-local timestamps.

This caused subscription transaction timestamps to be stored in the server's
local timezone instead of UTC, making them inconsistent with all other records
in the same table (StripeHandler and processOnetimeSuccess both use gmdate).

On a server with a non-UTC timezone, this would result in timestamps that are
offset by hours relative to the actual event time and other records.
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