Issue Bug Closed

#110020BackendUtility::daysUntil() crashes with Unsupported operand types: DateTimeImmutable - int when editing IRRE children with endtime/starttime fields

David Bornemann 06/08/26, 07:48 updated 08/11/26, 08:50

Description

Description:

Saving any IRRE children with an set endtime crashes the backend with:

PHP Fatal Error: Unsupported operand types: DateTimeImmutable - int
  in vendor/typo3/cms-backend/Classes/Utility/BackendUtility.php:867

Cause:

Formengine is converting all TCA type=datetime columns to DateTimeImmutable objects. When InlineRecordContainer::renderForeignRecordHeader() renders the IRRE child’s icon, it calls BackendUtility::getRecordIconAltText($record, $foreignTable, false), which then passes the $row[$endtimeField] into daysUntil which expects an integer.

Component:
vendor/typo3/cms-backend/Classes/Utility/BackendUtility.php

Steps to reproduce:

  1. Create any parent record containing an IRRE/inline relation to a child table that has starttime/endtime configured.
  2. In the child record’s “Access” tab, set an endtime date and save.
  3. The backend crashes with the fatal error above.

Proposed fix:

Get timestamp from Datetime Object if $tstamp is object

    /**
     * Returns the difference in days between input $tstamp and $EXEC_TIME
     *
     * @param \DateTimeInterface|int $tstamp Time stamp / DateTime Object
     */
    public static function daysUntil(\DateTimeInterface|int $tstamp):int
    {
        if ($tstamp instanceof \DateTimeInterface) {
            $tstamp = $tstamp->getTimestamp();
        }
        $delta_t = $tstamp - $GLOBALS['EXEC_TIME'];
        return (int)ceil($delta_t / (3600 * 24));
    }

Reviews 2

History 613

  1. Gerrit Code Review pushed patch set 1 for main to change 94372 status Accepted Under Review <span data-processor="relativetime" data-value="2026-06-08T19:21:51+00:00" > 06/08/26, 19:21 </span>

  2. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-06-08T19:25:46+00:00" > 06/08/26, 19:25 </span>

    Thanks, I’ve added a patch with this and also test/styleguide coverage, please have a look :)

  3. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-06-09T06:10:10+00:00" > 06/09/26, 06:10 </span>

    Applied in changeset commit:5736315749e765262fb12708e4f15a3e56cd9e24.