Issue Bug Resolved

#98068Import fails for records having fields with l10n_mode=exclude and a relation (to sys_file_reference)

Daniel Haupt 08/02/22, 17:10 updated 10/10/26, 10:40

Description

Exception:

Uncaught TYPO3 Exception Argument 3 passed to TYPO3\CMS\Core\DataHandling\DataHandler::addDefaultPermittedLanguageIfNotSet() 
must be of the type int, null given, called in /var/www/html/public/typo3/sysext/core/Classes/DataHandling/DataHandler.php on line 944
thrown in file /var/www/html/public/typo3/sysext/core/Classes/DataHandling/DataHandler.php in line 7952
How to reproduce:
  1. Export records of a page (!!! including localized records !!!) with a field of localization mode l10n_mode=exclude having a relation, e.g. to sys_file_reference. In my case, I was trying to export/import the carousel content element of ext:bootstrap_package.
  2. Try to import

*Analysis:*
The error occurs during step \TYPO3\CMS\Impexp\Import::setRelation. The reference of sys_file_reference, which originally should be imported, is removed in favor of a new record created as part of the pre-processing of the data map (public/typo3/sysext/core/Classes/DataHandling/DataHandler.php:852). This new record does not provide a pid which leads to this error.

Extract of \TYPO3\CMS\Core\DataHandling\DataHandler::$datamap:

array (
  'sys_file_reference' => 
   array (
    'NEW62e956ae46ee6060038927' => 
    array (
      'sys_language_uid' => 1,
      'l10n_parent' => 'sys_file_reference_3101',
    ),
  ),
)

Therefore, it seems like importing localized fields with the l10n_mode=exclude configuration having a relation to another table is currently not working.

Proposal:
  1. In general, the export should exclude those relations (sys_file_reference records) by default, because they are intended to be recreated by the DataHandler from the parent/source record. They are sanitized within the DataHandler and end-up as unused/invalid in the database (e.g. uid_foreign is not changed to the new record uid).
  2. Even without those relations, the DataMapProcessor creates an invalid new record (without pid value). Therefore, we have to ensure a pid before executing \TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor::synchronizeInlineRelations.

*Workaround:*
I am currently not aware of any workaround. As mentioned, excluding localized sys_file_reference records results in the same exception.

Reviews 4

History 49

  1. Benjamin Kott commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-10T10:40:11+00:00" > 10/10/26, 10:40 </span>

    Applied in changeset commit:960fd1d04ee9ae5a1537967e535c5daf9ddcb644.