Issue Bug Resolved

#97684DataHandler::addDefaultPermittedLanguageIfNotSet gets called with $pageId===null

Lina Wolf 05/24/22, 08:23 updated 10/10/26, 10:40

Description

I was doing an import of a hierarchical page tree. The import on level 1 failed (due to a missing default value for the database).

In line 7416 of the data handler this lead to just not creating the page record. It creates an entry in the log but does not fail the import.

Now uppon importing the next page the desired root page does not exists.

The local variable `$theRealPid` is not type-safe however and even initialized with “null” in line 885. However `$theRealPid` is used in line 944 as third parameter
of addDefaultPermittedLanguageIfNotSet. If it is still null here this causes a type error as the method only allows an integer as third parameter. This causes a hard to debug error as the actual problem happened not with the record in question but the previous record.

Chaning line 944 to `$this->addDefaultPermittedLanguageIfNotSet($table, $incomingFieldArray, $theRealPid ?? 0);` the import – of course – still fails. However instead of a php type error I get a propper error in the Import/Export tool.

TYPO3 11.5.10, reproduced on current 11.5 branch of the mono-repository. Didn’t check on main yet.

Reviews 4

History 38

  1. Daniel Haupt commented <span data-processor="relativetime" data-value="2022-08-02T12:25:50+00:00" > 08/02/22, 12:25 </span>

    I got the same error message while importing, but probably for a different reason.

    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.phpin line 7952

    In my case, the error occurs during \TYPO3\CMS\Impexp\Import::setRelation related to a field of l10n_mode=exclude which references a sys_file_reference.
    The reference, which originally should be created as part of the import, is removed in favor of a new record created as part of the pre-processing of the datamap (public/typo3/sysext/core/Classes/DataHandling/DataHandler.php:852). This new record does not provide a pid which leads to this error.

    Therefore, it seems like importing localized fields with the l10n_mode=exclude configuration is currently not working.

  2. 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.