Review main Merged

88658[BUGFIX] Treat 0 as a defined value for nullable datetime fields

Benjamin Franzke CR +2 V +2 Normal +168 −67 updated 03/27/25, 10:15

Commit message

For a nullable integer based datetime field the value `0` refers to the
unix epoch time (1970-01-01T00:00:00Z), only an explicit `null` database
value shall be considered an empty value.

This makes workarounds that combine default=0 and range.lower conditions
superfluous and invalid, since `default=0` does not mean empty for a
nullable field, but "unix epoch time".

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 13

Review log 2231

Show 36 earlier messages
  1. Benjamin Franzke uploaded patch set 1 03/20/25, 10:56

  2. core-ci voted on patch set 1 V -1 03/20/25, 11:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75886

  3. Benjamin Franzke uploaded patch set 2 V -1 03/20/25, 12:49

  4. core-ci voted on patch set 2 V -1 03/20/25, 13:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75890

  5. Benjamin Franzke uploaded patch set 3 V -1 03/20/25, 13:05

  6. core-ci voted on patch set 3 V -1 03/20/25, 13:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75891

  1. Benjamin Franzke uploaded patch set 4 V -1 03/20/25, 13:23

  2. core-ci voted on patch set 4 V +1 03/20/25, 13:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75895

  3. Benjamin Franzke uploaded patch set 5 V +1 03/20/25, 13:51

  4. Benjamin Franzke marked it ready for review 03/20/25, 13:53

  5. core-ci voted on patch set 5 V +1 03/20/25, 13:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75898

  6. Benjamin Franzke uploaded patch set 6 V +1 03/20/25, 14:15

  7. core-ci voted on patch set 6 V +1 03/20/25, 14:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75900

  8. Benni Mack voted on patch set 6 CR +1 V +1 03/20/25, 15:53

  9. Garvin Hicking commented on patch set 6 03/20/25, 21:00

    Important-106401-Treat0AsADefinedValueForNullableDatetimeFields.rst:22

    I haven't checked this yet, but as a reader I would ask: Is "nullable" the default for TCA, if I have not specified it myself? Maybe we could answer that here. Also, as a reader, I would probably ask myself, if this can have negative implications for existing projects. (Probably the answer might be: If you use manual DB access/evaluation, or have extbase domain models mapped that cannot deal with receiving NULL values, you will get type errors. I know bug fixes are always a BC, so as a reader I would like to know what my 'heads up' scenario is, and what to look out for)
  10. Garvin Hicking commented on patch set 6 03/20/25, 21:19

    tx_styleguide_elements_basic.php:497

    would keeping/having such a case be beneficial to spot issues that extensions might face? (it makes less sense with the new behavior of course, but I'm quite sure people may have this kind of TCA setup. Should we add a TCA migration to report this setup with nullable+default=0?)
  11. Benjamin Franzke uploaded patch set 7 CR +1 V +1 03/21/25, 05:12

  12. Benjamin Franzke commented on patch set 7 03/21/25, 05:12

    Important-106401-Treat0AsADefinedValueForNullableDatetimeFields.rst:22 Reply

    thanks, good point. done.

    tx_styleguide_elements_basic.php:497 Reply

    yes, but we have that case in inputdatetime_11. (with nullable false) I moved to a new column name, since existing (test) instances that have been generated by ext:styleguide (by raw import, datahandler would have never written that) were initialized with the invalid value `0` (does not match lower criteria) in database instead of null.
  13. core-ci voted on patch set 7 V +1 03/21/25, 05:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75928

  14. Garvin Hicking commented on patch set 7 03/21/25, 07:06

    tx_styleguide_elements_basic.php:497 Reply

    Thanks for the text improvement, that clears up more for me. What I meant here was, if we should have a case of nullable+dwfault '0', that is not longer contained? People may have this set up, and I guess this will continue to work and put a '1970' stamp as values? Or will datahandler ignore the '0' default and enforce 'null'? (sorry cant actually test this myself, mobile only for the weekend)
  15. Benjamin Franzke uploaded patch set 8 V +1 03/21/25, 07:22

  16. Benjamin Franzke commented on patch set 8 03/21/25, 07:22

    tx_styleguide_elements_basic.php:497 Reply

    Ah I see, sounds good. Done.
  17. core-ci voted on patch set 8 V +1 03/21/25, 07:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75935

  18. Benni Mack voted on patch set 8 CR +1 V +1 03/22/25, 14:32

  19. Benjamin Franzke uploaded patch set 9 CR +1 V +1 03/26/25, 19:19

    Rebase
  20. core-ci voted on patch set 9 V +1 03/26/25, 19:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76401

  21. Garvin Hicking commented on patch set 9 CR +1 V +1 03/26/25, 19:35

    (forgot to submit my vote, was stored as draft) I have tested a few cases, also with settings of my projects, and this seems to work well. It closes a "conceptual mistake" and I believe it should in most cases really be the actual intended setup. Since fields created as nullable were already able to return NULL, any extbase implementation should be unaffected by this (or else, NULLable fields would be wrongly set in third party code and would need to be set NOT NULLable). Having said this: Nonetheless I am still a bit afraid of this. But we need to address this, so.... lgtm :)
  22. Georg Ringer voted on patch set 9 CR +1 V +1 03/26/25, 21:43

  23. Benni Mack voted on patch set 9 CR +1 V +1 03/27/25, 08:39

  24. Benjamin Franzke voted on patch set 9 CR +2 V +2 03/27/25, 09:58

  25. Benjamin Franzke merged patch set 10 03/27/25, 10:15