Closed (fixed)
Project:
Commerce Core
Version:
3.x-dev
Component:
Payment
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2019 at 18:48 UTC
Updated:
10 Dec 2025 at 10:59 UTC
Jump to comment: Most recent
Timestamps are signed 32-bit integers, which means the last date available for storage is 19 January 2038.
A user testing Stripe ran into an error where an expiration after 2037 caused a failed database transaction. (#3070494: Fatal error when card expiration is after January 19, 2038.)
How should we handle this in commerce? It's something which will affect all payment gateways. This happens when storing a payment method.
Drupal core issue: #2885413: Timestamp field items are affected by 2038 bug
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mglamanLinking related issues. Looks like there is a warning check for 32bit systems, but the timestamp still does not have changed sizing.
Comment #3
mglamanComment #4
johnpicozziRan into this error with the stripe module as well. Seems some kind of validation is in order. Does the Credit Card Industry have a standard for how far in the future the expiration date can be? If so could some kind of validation to check against that be added? I'm sure this isn't that easy, just thinking out loud.
Comment #5
fool2 commentedAlso experienced this in testing. I think we should just make a validation for this to avoid the fatal error (have the exp date fail validation instead of trigger the error)
Then when 2038+ is supported we can remove the validation.
Comment #6
fool2 commentedMarking this as a bug because a fatal error is a user interface problem.
Comment #7
simgui8 commentedI just came accross this testing Stripe.
To prevent friction from wsod (customer typo), and since I don't think we can add validation to Stripe fields, I ended up creating a lame patch that does
within setExpiresTime method in the PaymentMethod class.
I'll stick to that until #2885413: Timestamp field items are affected by 2038 bug lands.
Also related: https://www.drupal.org/node/3227494
Comment #8
newaytech commentedFor the benefit of others landing here - I've today had this happen in a production site. Customer has a debit card with expiry of October 2039 - so these cards are out there... The card payment succeeded with Stripe - then choked in Commerce. Will have to manually place order.
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'expires' at row 1: INSERT INTO "commerce_payment_method"Comment #9
ivnishComment #10
rszrama commentedWhy don't we just convert this particular field to unsigned? We don't need to support expiration dates before the UNIX epoch began. 🤷♂️
Comment #11
jsacksick commented@rszrama: Because we use a "timestamp" field which defines the following schema:
As opposed to a regular "integer" which exposes the following schema:
It's possible for integer fields to mark the field as "unsigned" from the field definition which is not possible for Timestamp fields.
I wonder if we could fix this from a storage schema class in the meantime, until Drupal core supports setting the unsigned boolean from the field definition.
Comment #12
jsacksick commentedBumping the priority, will try fixing this today.
Comment #14
jsacksick commentedTempted to go ahead and merge this as I tested this on a new install and on an existing install successfully.
However, would be great if somebody else could RTBC the change.
Comment #15
jsacksick commentedComment #17
jsacksick commentedWent ahead and merged the MR.