Feature #72053

Epic #77562: Misbehaviors with datetime values and timezones

Extbase: Support \DateTimeInterface instead of \DateTime

Added by Sebastian Michaelsen over 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-12-04
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Extbase supports conversion from and to \DateTime objects in several situations. But you cannot work with \DateTimeImmutable or other implementations of the \DateTimeInterface.
Extbase should support working with the interface instead of the concrete class.


Related issues

Related to TYPO3 Core - Bug #73637: Extbase DateTimeConverter cannot handle negative timestamps New 2016-02-23
Related to TYPO3 Core - Bug #90992: Fix programming error that only works for subtle reasons Closed 2020-04-09

Associated revisions

Revision aabe5f71 (diff)
Added by Benni Mack over 1 year ago

[BUGFIX] Respect DateTimeImmutable in Extbase

The DateTimeConverter and DataMapper of Extbase now checks for
DateTimeInterface, and can thus handle DateTimeImmutable, otherwise
Extbase cannot handle these kinds of formats.

Resolves: #72053
Releases: master
Change-Id: Ic922e715a31e1d02f5f6daa18415e8376788da8b
Reviewed-on: https://review.typo3.org/57388
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

Revision 2f312e2c (diff)
Added by Volker Diels-Grabsch about 2 months ago

[BUGFIX] Do not perform string-with-boolean comparisons in switch cases

This commit fixes a string-with-boolean comparison in a switch case.
Instead, this complex case is moved down to the default case where all
other complex cases are handled as well.

Resolves: #90992
Related: #89857
Related: #72053
Releases: master, 9.5
Change-Id: I43730176e1a46a2bc63ea4d45bcf4511c1970aab
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64113
Tested-by: Jonas Eberle <>
Tested-by: Markus Klein <>
Tested-by: Georg Ringer <>
Tested-by: TYPO3com <>
Reviewed-by: Jonas Eberle <>
Reviewed-by: Markus Klein <>
Reviewed-by: Oliver Bartsch <>
Reviewed-by: Georg Ringer <>

Revision 149103e8 (diff)
Added by Volker Diels-Grabsch about 2 months ago

[BUGFIX] Do not perform string-with-boolean comparisons in switch cases

This commit fixes a string-with-boolean comparison in a switch case.
Instead, this complex case is moved down to the default case where all
other complex cases are handled as well.

Resolves: #90992
Related: #89857
Related: #72053
Releases: master, 9.5
Change-Id: I43730176e1a46a2bc63ea4d45bcf4511c1970aab
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64132
Tested-by: TYPO3com <>
Tested-by: Georg Ringer <>
Reviewed-by: Georg Ringer <>

History

#1 Updated by Sebastian Michaelsen over 4 years ago

  • Target version set to 8 LTS

#2 Updated by Sebastian Michaelsen over 4 years ago

As far as I see this would affect the following things would need to be changed:

  • Wrong: When loading a database record into a model object, the DataMapper creates a \DateTime object even when the property is annotated as \DateTimeImmutable.
  • Wrong: When saving a model to the database the \TYPO3\CMS\Extbase\Persistence\Generic\Backend results in an exception because ->getPlainValue() doesn't convert \DateTimeImmutable to a timestamp.
  • More or less right: The DateTimeConverter doesn't force \DateTime but performs duck typing (is_callable(array($targetType, 'createFromFormat'))). But the override feature (->overrideTimeIfSpecified()) forces the first paramter to be \DateTime.

#3 Updated by Riccardo De Contardi over 3 years ago

  • Target version changed from 8 LTS to 9.0

#4 Updated by Mona Muzaffar about 3 years ago

  • Related to Epic #80852: Datetime handling in backend added

#5 Updated by Riccardo De Contardi almost 3 years ago

  • Parent task set to #77562

#6 Updated by Riccardo De Contardi almost 3 years ago

  • Related to deleted (Epic #80852: Datetime handling in backend)

#7 Updated by Susanne Moog over 2 years ago

  • Target version deleted (9.0)

#8 Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

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

#9 Updated by Gerrit Code Review almost 2 years ago

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

#10 Updated by Gerrit Code Review almost 2 years ago

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

#11 Updated by Gerrit Code Review over 1 year ago

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

#12 Updated by Gerrit Code Review over 1 year ago

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

#13 Updated by Gerrit Code Review over 1 year ago

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

#14 Updated by Benni Mack over 1 year ago

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

#15 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

#16 Updated by Benni Mack 2 months ago

  • Related to Bug #73637: Extbase DateTimeConverter cannot handle negative timestamps added

#17 Updated by Volker Diels-Grabsch about 2 months ago

  • Related to Bug #90992: Fix programming error that only works for subtle reasons added

Also available in: Atom PDF