Bug #89022

TCA eval => 'date' sometimes fails with error

Added by Georg Tiefenbrunn 4 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2019-08-27
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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).

Also available in: Atom PDF