Project

General

Profile

Actions

Bug #98068

open

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

Added by Daniel Haupt over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Import/Export (T3D)
Target version:
Start date:
2022-08-02
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #97684: DataHandler::addDefaultPermittedLanguageIfNotSet gets called with $pageId===nullNew2022-05-24

Actions
Actions #1

Updated by Nikita Hovratov about 1 year ago

  • Related to Bug #97684: DataHandler::addDefaultPermittedLanguageIfNotSet gets called with $pageId===null added
Actions

Also available in: Atom PDF