Project

General

Profile

Actions

Bug #104668

closed

RuntimeException in history module for deleted record with FlexForm

Added by Daniel Siepmann 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2024-08-20
Due date:
% Done:

0%

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

Description

Not sure about older versions, we currently have the issue in 12.4.16.

Steps to reproduce:

  1. Create a tt_content element with a pi_flexform
  2. Change something within the FlexForm of the element
  3. Delete the element
  4. Open history of the page with the element

The following exception will be shown:

(1/1) #1463578899 RuntimeException

TCA misconfiguration in table "tt_content" field "pi_flexform" config section: ds_pointerField "list_type" points to a field name that does not exist.
in /vendor/typo3/cms-core/Classes/Configuration/FlexForm/FlexFormTools.php line 482

            // ds_pointerField to some field name should take care that field does exist, too. They are a pair,
            // so there shouldn't be a situation where the field does not exist. Throw an exception if that is violated.
            if (!isset($row[$pointerFieldArray[0]])) {
                // If it's declared, it must exist -> not catchable
                throw new \RuntimeException(
                    'TCA misconfiguration in table "' . $tableName . '" field "' . $fieldName . '" config section:'
                    . ' ds_pointerField "' . $pointerFieldArray[0] . '" points to a field name that does not exist.',
                    1463578899
                );

at TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools->getDataStructureIdentifierFromTcaArray()
in /vendor/typo3/cms-core/Classes/Configuration/FlexForm/FlexFormTools.php line 205

                $fieldName,
                $row
            );
        } elseif (is_array($tcaDataStructureArray)) {
            $dataStructureIdentifier = $this->getDataStructureIdentifierFromTcaArray(
                $fieldTca,
                $tableName,
                $fieldName,
                $row

at TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools->getDefaultIdentifier()
in /vendor/typo3/cms-core/Classes/Configuration/FlexForm/FlexFormTools.php line 175

    public function getDataStructureIdentifier(array $fieldTca, string $tableName, string $fieldName, array $row): string
    {
        $dataStructureIdentifier = $this->eventDispatcher
            ->dispatch(new BeforeFlexFormDataStructureIdentifierInitializedEvent($fieldTca, $tableName, $fieldName, $row))
            ->getIdentifier() ?? $this->getDefaultIdentifier($fieldTca, $tableName, $fieldName, $row);

        $dataStructureIdentifier = $this->eventDispatcher
            ->dispatch(new AfterFlexFormDataStructureIdentifierInitializedEvent($fieldTca, $tableName, $fieldName, $row, $dataStructureIdentifier))
            ->getIdentifier();

at TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools->getDataStructureIdentifier()
in /vendor/typo3/cms-backend/Classes/View/ValueFormatter/FlexFormValueFormatter.php line 81

        array $record
    ): array {
        $conf['config'] = $tcaConfiguration;
        $flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
        $flexFormIdentifier = $flexFormTools->getDataStructureIdentifier($conf, $tableName, $fieldName, $record);
        return $flexFormTools->parseDataStructureByIdentifier($flexFormIdentifier);
    }

    /**

at TYPO3\CMS\Backend\View\ValueFormatter\FlexFormValueFormatter->getFlexFormDataStructure()
in /vendor/typo3/cms-backend/Classes/View/ValueFormatter/FlexFormValueFormatter.php line 56

        $record = BackendUtility::getRecord($tableName, $uid) ?? [];

        // Get FlexForm data and structure
        $flexFormDataArray = GeneralUtility::xml2array($value);
        $flexFormDataStructure = $this->getFlexFormDataStructure($fieldConfiguration, $tableName, $fieldName, $record);

        // Map data to FlexForm structure and build an easy to handle array
        $processedSheets = $this->getProcessedSheets($flexFormDataStructure, $flexFormDataArray['data']);

The issue seems to be within FlexFormValueFormatter which fetches the record but only if it is not deleted. It than passes the record down the stack until a validation will check the pointer field which doesn't exist in the empty record array due to being a deleted record.


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #102656: Exception in record history with outdated content element configurationClosedGeorg Ringer2023-12-12

Actions
Actions #1

Updated by Gerrit Code Review 3 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85695

Actions #2

Updated by Daniel Siepmann 3 months ago

  • Is duplicate of Bug #102656: Exception in record history with outdated content element configuration added
Actions #3

Updated by Daniel Siepmann 3 months ago

  • Status changed from Under Review to Closed
Actions

Also available in: Atom PDF