Bug #94699
Updated by Moritz Ngo over 3 years ago
When using a <code>\DateTimeImmutable</code> property and <code>dbType</code> TCA <code>dbType</code> is set to <code>date</code>, <code>time</code> or <code>datetime</code> then the actual value won't get persisted as UTC in the database. After the value has been persisted, the value will be read from the database and interpreted as UTC, thus the model will have a wrong <code>\DateTimeImmutable</code> property value. The issue is caused, by <code>\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getPlainValue()</code> where timezone will be set to UTC. The <code>\DateTimeImmutable</code> won't be updated with the "new" timezone, thus a wrong value will be stored. This issue occurs in the following TYPO3 CMS versions: * v10.4 LTS https://github.com/TYPO3-CMS/extbase/blob/v10.4.18/Classes/Persistence/Generic/Mapper/DataMapper.php#L752 * v9.5 LTS https://github.com/TYPO3-CMS/extbase/blob/v9.5.28/Classes/Persistence/Generic/Mapper/DataMapper.php#L774 * v8.7 LTS https://github.com/TYPO3-CMS/extbase/blob/v8.7.32/Classes/Persistence/Generic/Mapper/DataMapper.php#L705 * v7.6 LTS https://github.com/TYPO3/typo3/blob/v7.6.32/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php#L703 TYPO3 CMS v11 should not be affected, because the the timezone won't be altered.