Issue Bug Closed

#108630TYPO3 impexp:export command throws error when using the exclude option

Dan Kleine (Untenzu) 01/14/26, 13:57 updated 03/31/26, 08:59

Description

In a recent project I did an export via CLI command with multiple exclude pages like this:

vendor/bin/typo3 impexp:export —type t3d_compressed —levels 4 —table _ALL —include-related _ALL —include-static sys_file_storage —exclude pages:203 —exclude pages:204 —exclude pages:205 —pid 192 STYLEGUIDE
(ddev typo3 impexp:export —type t3d_compressed —levels 4 —table _ALL —include-related _ALL —include-static sys_file_storage —exclude pages:203 —exclude pages:204 —exclude pages:205 —pid 192 STYLEGUIDE)

When I do this I get the following error in TYPO3 14:

> Uncaught TYPO3 Exception explode():
> Argument #2 ($string) must be of type string, int given
> thrown in file /var/www/html/vendor/typo3/cms-impexp/Classes/Export.php
> in line 413

Reason: The CLI command returns an indexed array [0 => “pages:123”]
but Export::getExcludePagesClause() expects an associative array [“pages:123” => 1]
(`$tableAndUid => $isExcluded`) to iterate over keys properly.

The `explode(‘:’, $tableAndUid)` call fails because `$tableAndUid` contains
the numeric array key (0, 1, 2…) instead of the expected string like “pages:123”.

The fix is to change the way exclude pages are processed in the ExportCommand.php file,
so that the array is built as associative array.
vendor/typo3/cms-impexp/Classes/Command/ExportCommand.php:183

// Old:
$this->export->setExcludeMap($input->getOption(‘exclude’));
// New:
$this->export->setExcludeMap(array_fill_keys($input->getOption(‘exclude’), 1));

Reviews 3

History 39

  1. Dan Kleine (Untenzu) commented 01/14/26, 14:08

    Got this error in TYPO3 12. Also exists in main.

  2. Gerrit Code Review pushed patch set 1 for main to change 92330 status New Under Review 01/14/26, 14:17

  3. Gerrit Code Review pushed patch set 2 for main to change 92330 01/14/26, 14:21

  4. Gerrit Code Review pushed patch set 3 for main to change 92330 01/15/26, 06:25

  5. Gerrit Code Review pushed patch set 1 for 13.4 to change 92582 01/30/26, 07:35

  6. Gerrit Code Review pushed patch set 1 for 12.4 to change 92583 01/30/26, 07:35

  7. Gerrit Code Review pushed patch set 2 for 12.4 to change 92583 01/30/26, 07:44

  8. Dan Kleine (Untenzu) commented and changed status Under Review Resolved done 0 % 100 % 01/31/26, 08:45

    Applied in changeset commit:eb66f2f3a91b2ab165b3d50eb92a3aa1b2b07e5b.

  9. Benni Mack changed status Resolved Closed 03/31/26, 08:59