Project

General

Profile

Actions

Bug #103838

closed

label_alt triggers PHP warning when pointing to certain field types

Added by Manfred Egger 7 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-05-15
Due date:
% Done:

100%

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

Description

When we set label_alt of a table to a field of type select then a PHP warning is raised:

Array to string conversion in typo3_src-12.4.15/typo3/sysext/backend/Classes/Utility/BackendUtility.php line 1543

This occurs since TYPO3 12.4.15, with older versions there doesn't seem to be a problem. I did the tests with PHP 8.2. I don't know if different PHP versions make any difference.

Steps to reproduce:

  • Add the following code in some EXT:xxxx/Configuration/TCA/Overrides/tt_content.php
    $GLOBALS['TCA']['tt_content']['ctrl']['label_alt'] = 'header_layout';
    

    Instead of header_layout you can use any field of type select to trigger the problem.
  • Clear the cache
  • Edit any existing content element
  • The warning should be triggered.

The warning is not triggered when creating a new record. If you create a new record you need to close the edit form and edit the record again.
Maybe the problem also occurs for other field types, I only tested select fields with renderType = 'selectSingle'


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #103892: PHP Warning: Array to string conversion in BackendUtility when label_alt with multivalue fieldClosed2024-05-24

Actions
Actions #1

Updated by Chris Müller 7 months ago

I can confirm that this happens since v12.4.15.

Actions #2

Updated by Marco Huber 7 months ago

I can confirm this issue with a nested inline field.
Field in fe_users TCA:

...
'columns' => [
    'usermemberships' => [
        'config' => [
            'type' => 'inline',
            'allowed' => 'tx_theme_domain_model_user_membership',
            'foreign_table' => 'tx_theme_domain_model_user_membership',
            'foreign_field' => 'user',
            'foreign_label' => 'membership',
            'foreign_selector' => 'membership',
...

Related table usermembership TCA:

...
    'ctrl' => [
        'label' => 'order_number',
        'label_alt' => 'membership',
        'label_alt_force' => true,
...
    'columns' => [
        'order_number' => [
            'config' => [
                'type' => 'input',
                'eval' => 'trim',
            ],
        ],
        'membership' => [
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'allowed' => 'tx_theme_domain_model_membership',
                'foreign_table' => 'tx_theme_domain_model_membership',
                'maxitems' => 1,
                'minitems' => 1,
                'size' => 10,
                'eval' => 'int',
            ],
        ],
...

Related table membership TCA:

...
    'ctrl' => [
        'label' => 'title',
...
    'columns' => [
        'title' => [
            'config' => [
                'type' => 'input',
                'eval' => 'trim',
                'required' => true,
            ],
        ],
...

Actions #3

Updated by Tymoteusz Motylewski 7 months ago

  • Is Regression set to Yes
Actions #4

Updated by Gerrit Code Review 7 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/+/84334

Actions #5

Updated by Gerrit Code Review 7 months ago

Patch set 1 for branch 12.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/+/84352

Actions #6

Updated by Oliver Bartsch 7 months ago

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

Updated by Georg Ringer 7 months ago

  • Has duplicate Bug #103892: PHP Warning: Array to string conversion in BackendUtility when label_alt with multivalue field added
Actions #8

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF