Issue Bug Closed

#89022TCA eval => 'date' sometimes fails with error

Georg Tiefenbrunn 08/27/19, 08:10 updated 07/11/24, 15:25

Description

Looking into the error log I stumbled upon the following error:

> Core: Exception handler (WEB): Uncaught TYPO3 Exception: DateTime::__construct(): Failed to parse time string (1566777600) at position 8 (0): Unexpected character | Exception thrown in file …/typo3/sysext/core/Classes/DataHandling/DataHandler.php in line 1904.

I can’t reproduce the error in BE :( The request indicates that the error occurs when saving new records.

// TCA definition
'config' => [
    'type' => 'input',
    'renderType' => 'inputDateTime',
    'dbType' => 'date',
    'eval' => 'date',
    'size' => 10,
    'default' => null,
]

TYPO3\CMS\Core\DataHandling\DataHandler::checkValueForInput()

9.5 https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1904
10 https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1738

$dateTime = new \DateTime($value);

Under conditions I can’t reproduce $value passed to \DateTime() is an integer (see error above: 1566777600 = 2019-08-26T00:00:00+00:00).

Reviews 3