Issue Bug Closed

#104233PHP Warning: Undefined array key "minitems" for editors with no permissions to sys_file_reference

Georg Ringer 06/27/24, 14:11 updated 10/15/24, 09:29

Description

Setting up an editor to allow tt_content but not sys_file_references leads to a strange error

PHP Warning: Undefined array key "minitems" in /var/www/html/typo3/sysext/backend/Classes/Form/Container/FilesControlContainer.php line 169

Problematic code

 $this->fileReferenceData['config'][$formFieldIdentifier . '-' . self::FILE_REFERENCE_TABLE] = [
            'min' => $config['minitems'],
            'max' => $config['maxitems'],
            'sortable' => $config['appearance']['useSortable'] ?? false,
            'top' => [
                'table' => $top['table'],
                'uid' => $top['uid'],
            ],
            'context' => [
                'config' => $configJson,
                'hmac' => $this->hashService->hmac($configJson, 'FilesContext'),
            ],
        ];

The reason is simple: \TYPO3\CMS\Backend\Form\FormDataProvider\TcaFiles does early checks if the user doesn’t have access and if not, no default min/max items are initialized

Reviews 2

History 26

  1. Gerrit Code Review pushed patch set 1 for main to change 84944 status Accepted Under Review 06/27/24, 14:14

  2. Gerrit Code Review pushed patch set 2 for main to change 84944 06/27/24, 14:47

  3. Gerrit Code Review pushed patch set 3 for main to change 84944 07/03/24, 06:03

  4. Gerrit Code Review pushed patch set 1 for 12.4 to change 86219 09/20/24, 09:49

  5. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 09/20/24, 10:00

    Applied in changeset commit:6327d33693bd86430e56a369b3427dd8a085b0a5.

  6. Benni Mack changed status Resolved Closed 10/15/24, 09:29