Bug #80068

Type value (?) from database record not defined in TCA of table

Added by Christoph Dörfel over 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2017-03-01
Due date:
% Done:

0%

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

Description

DatabaseRecordTypeValue->addData() throws an exception if $recordTypeValue could not be found.

This happens for records that are not in the default language with no l10n_parent (i.e. l10n_parent = 0), have a TCA field configuration with multiple types but no default type "0" and a TCA field configuration with "l10n_mode = exclude" set.

DatabaseRecordTypeValue->getValueFromDefaultLanguageRecordIfConfigured() returns null since $result['defaultLanguageRow'] is null and there's no null check in place.

Sample TCA:

'tx_extbase_type' => [
    'exclude' => 1,
    'l10n_mode' => 'exclude',
    'label' => 'Extbase type',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => [
            ['Type A, 'Tx_Extension_Domain_Model_A'],
            ['Type B', 'Tx_Extension_Domain_Model_B']
        ],
        'size' => 1,
        'maxitems' => 1,
        'default' => 'Tx_Extension_Domain_Model_A'
    ]
]

History

#1 Updated by Christian Kuhn over 2 years ago

  • Status changed from New to Needs Feedback

mmmh, a record not in default language with l10n_parent = 0 and then having l10n_mode=exclude does not make sense.

#2 Updated by Christoph Dörfel over 2 years ago

Christian Kuhn wrote:

mmmh, a record not in default language with l10n_parent = 0 and then having l10n_mode=exclude does not make sense.

Haha, yes.
Although records in the database and the TCA configuration should somehow match, a user might be able to change the sys_language_uid of a record (from default to something > 0). After that the user can never undo his mistake because of the "Uncaught TYPO3 Exception" and is stuck with a broken record.

From the TCA Reference Documentation:

l10n_mode = exclude – Field will not be shown in TCEforms if this record is a localization of the default language.

So the field should be shown since the record is not a localization of the default language. It's no a record in the default language either, but that's another story.

#3 Updated by Oliver Hader about 2 years ago

  • Category changed from DataHandler aka TCEmain to FormEngine aka TCEforms

#4 Updated by Alexander Opitz almost 2 years ago

  • Status changed from Needs Feedback to New

Also available in: Atom PDF