Project

General

Profile

Actions

Bug #99937

closed

2038-Bug in TYPO3?

Added by Dieter Porth about 1 year ago. Updated 5 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2023-02-13
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The often used fields timestamp, crDate, starttime, and endtime are stored with the definition int(10) unsigned.
This can cause a 2038-bug, because the integer will be restricted to 4 Bytes in the database by this definition.

I think, it would be better to use:
tstamp bigint NOT NULL DEFAULT '0' comment 'Use bigints for timestamps instead',


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #101553: Auto-create DB fields from TCA columnsNew2023-10-13

Actions
Actions #1

Updated by Andreas Kienast about 1 year ago

My 2 cents on this. This database change is doable with v12, but there's no need to backport such huge changes to older versions. By today, even v12 ELTS ends in 2029, leaving 9 years until we'll hit the 2038 bug.

I'd rather propose native DATETIME fields with v13 and deprecating the old int-based fields.

Actions #2

Updated by Dieter Porth about 1 year ago

There are today some TYPO3 6 Versions online, if i remember it correctly.
I think, it is okay, to make the change to bigint in version 12.

I don't think, that the native DATETIME-fields is a good idea, because you don't know
  1. which timezone is used for the field,
  2. which calendar is used (chinese, hebrew, ....) and
  3. which hour is used (The DATETIME-Field can mean two times in october, when the daylight saving time is reseted at that time. )

The Timestamp is defined in seconds for the timezone UTC. The timestamp is simple and easily converted with the Datetime-Object or with the IntlDateFormatter-Object to the calendar or timezone, you wish. (see my viewhelper <timer:format.calendarDate> in my extension `timer`)

I think, the unix-timestamp (in a bigint-field) is better than a DATETIME-field.

Actions #3

Updated by Česlav Przywara about 1 year ago

Dieter Porth wrote in #note-2:

The Timestamp is defined in seconds for the timezone UTC. The timestamp is simple and easily converted with the Datetime-Object or with the IntlDateFormatter-Object to the calendar or timezone, you wish.

Even timestamps have edge cases to consider, you might find this article interesting: https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/

Actions #4

Updated by Oliver Hader 12 months ago

  • Target version set to 13 LTS
Actions #5

Updated by Garvin Hicking 8 months ago

Changing it from INT to BIGINT would be a handy patch for the time being. Implementing DATETIME may cause a much larger refactoring I'd assume, and may need check how other DB backends handle these.

I'll try to prepare a patch (targetting v13 of course, because of the possible breaking impact) for getting BIGINT off the ground, because: It not only affects FUTURE timestamps, but also any other date field for i.e. sys_file_metadata.

We are working on a site where historical images are presented, and want to use content_creation_date for that. This only goes back to 1901 on INT columns, but we need of course until like... 1400BC. BIGINT (signed) would allow that. ;-)

Actions #6

Updated by Garvin Hicking 8 months ago

Actually: tstamp and some other INT UNSIGNED values allow to go up to the year 2106 and not only 2038. In the core these are:

starttime, endtime, tstamp, crdate

So that means we'd "only" need a way to define any TCA datetime to be either INT UNSIGNED instead of INT SIGNED.

And for some fields, support BIGINT (but let's not add extra storage space for EVERY field to BIGINT, because we're here to save the environment, right?)

Patch incoming.

Actions #7

Updated by Gerrit Code Review 8 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #8

Updated by Gerrit Code Review 8 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #9

Updated by Gerrit Code Review 8 months ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #10

Updated by Gerrit Code Review 8 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #11

Updated by Gerrit Code Review 8 months ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #12

Updated by Gerrit Code Review 8 months ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #13

Updated by Gerrit Code Review 8 months ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #14

Updated by Gerrit Code Review 8 months ago

Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #15

Updated by Gerrit Code Review 7 months ago

Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #16

Updated by Gerrit Code Review 7 months ago

Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #17

Updated by Gerrit Code Review 7 months ago

Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #18

Updated by Garvin Hicking 7 months ago

Actions #19

Updated by Gerrit Code Review 6 months ago

Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #20

Updated by Gerrit Code Review 6 months ago

Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #21

Updated by Gerrit Code Review 6 months ago

Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #22

Updated by Gerrit Code Review 5 months ago

Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #23

Updated by Gerrit Code Review 5 months ago

Patch set 16 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #24

Updated by Gerrit Code Review 5 months ago

Patch set 17 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80668

Actions #25

Updated by Garvin Hicking 5 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF