Bug #97684
openDataHandler::addDefaultPermittedLanguageIfNotSet gets called with $pageId===null
0%
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.
Updated by Daniel Haupt over 2 years ago
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.
Updated by Nikita Hovratov almost 2 years ago
- Related to Bug #98068: Import fails for records having fields with l10n_mode=exclude and a relation (to sys_file_reference) added