Project

General

Profile

Actions

Bug #77435

closed

IRRE throws exception if related record is deleted

Added by Markus Klein over 8 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2016-08-08
Due date:
% Done:

100%

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

Description

It is not possible to edit a record, which holds IRRE relations to deleted records.

DB-structure is an old one with comma-separated uids in parent record.
Example: ke_search filter, which holds references to filter options.

Deleting a referenced filter option leads to the filter itself not being editable anymore.
DatabaseRecordException with code #1437656081 "Record with uid ... not found"

Actions #1

Updated by Christian Kuhn over 8 years ago

  • Parent task set to #69617
Actions #2

Updated by Markus Klein over 8 years ago

  • Description updated (diff)
Actions #3

Updated by Georg Ringer over 8 years ago

The problem can be found here:
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php#L322-L326


        // For foreign_selector with useCombination $mainChild is the mm record
        // and $combinationChild is the child-child. For 1:n "normal" relations,
        // $mainChild is just the normal child record and $combinationChild is empty.
        $mainChild = $formDataCompiler->compile($formDataCompilerInput);
        if ($parentConfig['foreign_selector'] && $parentConfig['appearance']['useCombination']) {
            try {
                $mainChild['combinationChild'] = $this->compileChildChild($mainChild, $parentConfig);
            } catch (DatabaseRecordException $e) {

The first call to compile() must be caught as well. However generating a flash message there is not the full solution because this will then generate errors in \TYPO3\CMS\Backend\Form\Container\InlineRecordContainer::renderForeignRecordHeader as the required array information is not available.

Actions #4

Updated by Daniel Goerz about 8 years ago

  • Sprint Focus set to Stabilization Sprint
Actions #5

Updated by Oliver Hader almost 4 years ago

  • Status changed from Accepted to Closed
  • Is Regression changed from Yes to No
  • Sprint Focus deleted (Stabilization Sprint)

Probably won't be handled as regression fix after four years

Actions #6

Updated by Markus Klein almost 4 years ago

  • Parent task deleted (#69617)
Actions #7

Updated by Markus Klein almost 4 years ago

  • Status changed from Closed to Needs Feedback
  • Assignee set to Markus Klein
  • Target version deleted (Candidate for patchlevel)

I'm checking the current state again.

Actions #8

Updated by Philipp Kitzberger almost 4 years ago

I can confirm that this error is still present in TYPO3 9 with the following scenario where a model X has a mm-relation to fe_users:

        'users' => array(
            'label' => 'mm relation to fe_users',
            'config' => array(
                'type' => 'inline',
                'foreign_table' => 'fe_users',
                'MM' => 'tx_customext_x_user_mm',
                'MM_opposite_field' => 'uid_foreign',
                'maxitems' => 9999,
                'appearance' => array(
                    'collapseAll' => 1,
                    'levelLinksPosition' => 'none',
                    'showSynchronizationLink' => 1,
                    'showPossibleLocalizationRecords' => 0,
                    'showAllLocalizationLink' => 0,
                ),
            ),

        ),

I traced the cause down to https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php#L223

    protected function resolveRelatedRecords(array $result, $fieldName)
    {
        ...

        if ($result['inlineCompileExistingChildren']) {
            foreach ($connectedUidsOfDefaultLanguageRecord as $uid) {
                $compiledChild = $this->compileChild($result, $fieldName, $uid);
                $result['processedTca']['columns'][$fieldName]['children'][] = $compiledChild;
            }
        }
        return $result;
    }

A simple try-catch around the two line with $compiledChild seems to solve this problem. Then the mm record of the deleted user is not been rendered anymore at all.

Actions #9

Updated by Gerrit Code Review almost 4 years ago

  • Status changed from Needs Feedback to Under Review

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

Actions #10

Updated by Gerrit Code Review over 3 years ago

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

Actions #11

Updated by Gerrit Code Review over 3 years ago

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

Actions #12

Updated by Philipp Kitzberger over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF