#101805PHP deprecation error in BackendUtility::getProcessedValue()
Description
Nullable columns of TCA type datetime (introduced in v12) cause a PHP deprecation error in record info popup if the stored value is NULL.
> #1476107295 TYPO3\CMS\Core\Error\Exception
> PHP Runtime Deprecation Notice: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in vendor/typo3/cms-backend/Classes/Utility/BackendUtility.php line …
The exception is caused by passing NULL to strtotime() in BackendUtility.php:1691 (format=datetime) and BackendUtility.php:1731 (format=date).
Steps to reproduce
Add some columns of TCA type datetime:
-- ext_tables.sql
CREATE TABLE fe_users (
`test_date` date DEFAULT NULL,
`test_datetime` datetime DEFAULT NULL,
`test_time` time DEFAULT NULL
);
<?php
// EXT/Configuration/TCA/Overrides/fe_users.php
defined('TYPO3') or die();
$tca = [
'columns' => [
'test_date' => [
'label' => 'test_date',
'config' => [
'type' => 'datetime',
'dbType' => 'date',
],
],
'test_datetime' => [
'label' => 'test_datetime',
'config' => [
'type' => 'datetime',
'dbType' => 'datetime',
],
],
'test_time' => [
'label' => 'test_time',
'config' => [
'type' => 'datetime',
'dbType' => 'time',
'nullable' => true,
],
],
],
'palettes' => [
'2' => ['showitem' => 'first_name,--linebreak--,middle_name,--linebreak--,last_name,--linebreak--,test_date,test_datetime,test_time'],
],
];
$GLOBALS['TCA']['fe_users'] = array_replace_recursive($GLOBALS['TCA']['fe_users'], $tca);
- Open any existing fe_users record or create a new one leaving all three test columns empty (NULL value in database).
- Open the record info (list module → More options … → Display information; BE route show_item) to throw the exception.