Closed Bug 27070 Opened 25 years ago Closed 25 years ago

JavaScript Year 2038 Cookie Bug

Categories

(Core :: Networking: Cookies, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED WONTFIX

People

(Reporter: zooplah, Assigned: morse)

References

()

Details

When a JavaScript cookie's expire date is any time after January 18, 2038, it won't store between sessions. To see this bug in action, go to my homepage (the URL above). The cookie, set in the left frame, is set to expire January 19, 2038- the day that the bug starts. If you set it to an earlier date, it strores; a later date, it doesn't store. I've tested this on the build ids 2000012520 and 2000020608 on Windows 98.
*** Bug 27072 has been marked as a duplicate of this bug. ***
This is a consequence of the way we are storing the time. We store it as the number of seconds since January 1, 1970. It is stored in a variable of type time_t which is a signed 32-bit integer. The maximum value that can be stored is approximately 2 billion seconds or 68 years. Hence the upper limit of year 2038. This is not a new bug but rather the way netscape browsers (and probably others as well) have always behaved. Your cookie would not be set correctly in the 4.7 browser if it could display your page but 4.7 can't even get that far (it reports a JS error on your page). We have no plans on changing this implementation and so I have to mark this as wont-fix. Others would argue that you should never be setting cookies so far in the future (see bug 8530).
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → WONTFIX
verified wontfix
Status: RESOLVED → VERIFIED
Note also bug 187254, the less-severe Linux equivalent. > This is not a new bug No, of course it's not new. > Others would argue that you should never be setting cookies > so far in the future (see bug 8530). That should be (and is these days) up to the user's prefs, but 2038 won't be distant forever. (Granted, there are some years before this gets critical, and it may fix itself for free in the meanwhile.)
Can this be reviewed again as it should really be fixed.
You need to log in before you can comment on or make changes to this bug.