Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.
95162[BUGFIX] Handle empty dates consistently in Extbase
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 3
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/62/95162/3 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/62/95162/3 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Issues 1
Files 11
- typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/ColumnMap.php1+9 −0
- typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php3+34 −0
- typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php+1 −1
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/DateTimeStorage.phpnew+148 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Repository/DateTimeStorageRepository.phpnew+27 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TCA/tx_blogexample_domain_model_datetimestorage.phpnew+105 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/ext_tables.sql+6 −0
- typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/DateTimeStorageImport.csvnew+3 −0
- typo3/sysext/extbase/Tests/Functional/Persistence/DateTimeStorageLegacyTest.php1new+92 −0
- typo3/sysext/extbase/Tests/Functional/Persistence/DateTimeStorageTest.phpnew+85 −0
- typo3/sysext/extbase/Tests/Functional/Persistence/DateTimeStorageTestTrait.php1new+257 −0
Review log 910
-
Benjamin Kott uploaded patch set 1 08/07/26, 06:48
-
Benjamin Kott uploaded patch set 2 08/07/26, 13:20
-
Benjamin Kott marked it work in progress 10/16/26, 14:05
-
Benjamin Kott wrote 10/16/26, 14:05
Unset private -
Benjamin Franzke commented on patch set 2 10/16/26, 15:06
ColumnMap.php:150UnresolvedI think this is is wrong and should not check `this->dateTimeStorageFormat === null` at all. It causes legacy mariadb native dbType DateTime non-nullable fields (with explicit nullable=false) not to be considered. See typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DatetimeLegacyTest.php for more information. -
Benjamin Franzke commented on patch set 2 10/16/26, 15:06
Typo3DbQueryParser.php:392Unneded, normalization already happens in `$comparison->getOperator()`. -
Benjamin Kott uploaded patch set 3 10/16/26, 15:32
-
core-ci voted on patch set 3 V +1 10/16/26, 15:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111374
-
Markus Klein commented on patch set 3 10/20/26, 15:26
Not sure about the 0000-00-00 stuff. That's kind of legacy in MySQL and not working with any of "strict" or "NO_ZERO_DATE" SQL mode. For v15 I'd suggest we ensure that zero-date can't happen anymore by enforcing correct TCA/SQL? -
Benjamin Franzke commented on patch set 3 10/23/26, 10:23
Reply Unresolved
I agree, we should have deprecated it in v14. We "only" ensured that nullable for native datetime fields is enabled by default, but it was still possible to *explicitly* set `nullable=false`. We should disallow that and ship a repeatable upgrade wizard that migrates all (legacy) 0000-00-00 values to `null`. Given the fact that is requires non-strict mysql (or sqlite), do you think such a change would be fine as a breaking change? Anyway, whatever decision we make there: That doesn't help much for this extbase logic though, since we still have **non-nullable** integer based fields, where the topic is larger, since a lot of code presumes they are not nullable (thinking of StartTimeRestriction and EndTimeRestriction and possibly more).Typo3DbQueryParser.php:392ReplyDoneTypo3DbQueryParser.php:410Unresolvedwe do handle two cases now: ``` $query->equals('myDate', null); $query->logicalNot($query->equals('myDate', null)); ``` but the issue also (correctly) showed that greaterThan (and therefore also lessThan) need to be considered as well. I mean, the issue only mentions `$query->greaterThan('myDate', 0)`, but especially for `$query->lessThan('myDate', new \DateTime('now'))` we need to decide how to handle pseudo-null values (0 for type int, legacy 0000-00-00 for native). *It bascially needs to become a less than + != 0 for integer feelds.* Sorry to put this out as a blocker, but I feel it's not right to support `null` mapping to pseudo-null only for a subset of the `QueryInterface` operators.DateTimeStorageLegacyTest.php:31UnresolvedSince this one is based on logic in typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DatetimeLegacyTest.php I just noticed I incorrectly excluded sqlite back then (only focused on mysql because it required the custom sql mode setting). Have now adapted that in: > 97058: [TASK] Run the zero date tests on SQLite as well | https://review.typo3.org/c/Packages/TYPO3.CMS/+/97058 We should adapt that in here later on as well.DateTimeStorageTestTrait.php:127UnresolvedI think we need to clarify why explicit ´null` values are overwritten by random concrete time/date values.