#109175Object of class DateTimeImmutable could not be converted to string
Description
Context
I have an extension for managing concerts of my choirs. We have:
- A program (with various musical works)
- 1 or more concert (various dates, various locations)
- other details such as performers associated to the corresponding concert (a solist may be another one for instance)
- 1 or more concert (various dates, various locations)
Program TCA has IRRE for concerts:
'concerts' => [
'exclude' => false,
'label' => 'LLL:EXT:concerts/Resources/Private/Language/locallang_db.xlf:tx_concerts_domain_model_program.concerts',
'config' => [
'type' => 'inline',
'foreign_table' => 'tx_concerts_domain_model_concert',
'foreign_field' => 'program',
'maxitems' => 9999,
'appearance' => [
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1,
],
],
],
And concert, as said, has various properties such as date and location, the date is the “key” and as such as been defined as label for the record:
return [
'ctrl' => [
'title' => 'LLL:EXT:concerts/Resources/Private/Language/locallang_db.xlf:tx_concerts_domain_model_concert',
'label' => 'date',
'label_alt' => 'location',
'label_alt_force' => true,
'tstamp' => 'tstamp',
...
'columns' => [
...
'date' => [
'exclude' => false,
'label' => 'LLL:EXT:concerts/Resources/Private/Language/locallang_db.xlf:tx_concerts_domain_model_concert.date',
'config' => [
'type' => 'datetime',
'required' => true,
'default' => 0,
],
],
Behaviour
1. Content > Records: no problem showing the programs and the concerts
2. Editing a program record: crash with Object of class DateTimeImmutable could not be converted to string
Problem
- Seems only limited to the usage of a date as label for a record *in the context of IRRE*
- Works fine up to TYPO3 v13, running PHP 8.3
- Crash with TYPO3 v14 (main), PHP 8.5
- Crash with TYPO3 v14 (main), PHP 8.3
Stacktrace
Reviews 1
Files 2
History 35
-
Xavier Perseguers commented and changed attached processedValue.png <span data-processor="relativetime" data-value="2026-03-06T09:05:15+00:00" > 03/06/26, 09:05 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 93099 status
NewUnder Review <span data-processor="relativetime" data-value="2026-03-06T09:29:42+00:00" > 03/06/26, 09:29 </span> -
Gerrit Code Review pushed patch set 2 for main to change 93099 <span data-processor="relativetime" data-value="2026-03-06T09:30:42+00:00" > 03/06/26, 09:30 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-03-06T12:25:09+00:00" > 03/06/26, 12:25 </span>Applied in changeset commit:b4dcdded118f2767ce1f0f090f3d3fd8787e02f2.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-03-31T08:09:24+00:00" > 03/31/26, 08:09 </span>
Debugging a bit, I see the difference in
BackendUtility::getRecordTitle()Content > Records (listing of all records)
In that context (listing of concert records), we have
ctrlLabelValuebeing an int:processedValue.png
and thus the label of the concert is properly converted to a human-readable date and time
IRRE
Instead of getting the Unix timestamp of the date, the same method BackendUtility::getRecordTitle()@ is a
\DateTimeImmutableand the(string)cast of the parameter causes the crash.I’d suggest converting to an int first in that case, with a check just as we have for
is_array()