Project

General

Profile

Actions

Bug #88624

closed

Backend selectTree PHP Warning

Added by Markus Klein almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Backend API
Target version:
-
Start date:
2019-06-24
Due date:
% Done:

100%

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

Description

Due to undefined [config][items] of renderType=selectTree a PHP Warning is issued:

#1476107295: PHP Warning: array_column() expects parameter 1 to be array, null given in typo3_src_8.7/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaRecordTitle.php line 241

The reason is that no FormDataProvider is generating the items array for a tree (only for all other types of select elements).

A cheap workaround is to add an empty items array to the TCA:

'category' => [
    'exclude' => false,
    'label' => 'Foo',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectTree',
        'foreign_table' => 'sys_category',
        'foreign_table_where' => 'AND sys_category.pid IN (###PAGE_TSCONFIG_IDLIST###) AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC',
        'items' => [],
        'minitems' => 1,
        'maxitems' => 1,
        'treeConfig' => [
            'parentField' => 'parent',
            'appearance' => [
                'expandAll' => true,
                'showHeader' => true,
                'maxLevels' => 2,
                'nonSelectableLevels' => '0,1'
            ],
        ]
    ],
],

The core needs a fix to handle the missing items array correctly.

We face this issue with a custom extension that uses this TCA inside a record that is nested with IRRE in the main record.
Main record: project
Nested record: assignment (relation to project and to sys_category)

Actions #1

Updated by Gerrit Code Review almost 5 years ago

  • Status changed from New 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/+/61122

Actions #2

Updated by Markus Klein almost 5 years ago

  • PHP Version set to 7.2
Actions #3

Updated by Markus Klein almost 5 years ago

  • Description updated (diff)
Actions #4

Updated by Joerg Kummer almost 5 years ago

@Markus Klein - Thx for extended description to reproduce.

As mentioned in our Gerrit, I can't reproduce such PHP warning in my local review installations with development settings in TYPO3 v8.7 and v10.0-dev with PHP 7.2.
I understand and accept the requirement for this issue, but also want to verify your patch. Maybe I have a misconfiguration to reproduce.

I tried different TCA configurations, and also your example TCA configuration by overwrite my preferred extension for such cases in: EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php column select_single_1 (with and without the array part for 'items' => []) with no success. I also emptied all sys_category entries in DB. Backend worked in all cases as expected, without warnings and no error entries in my Apache error log.

Do you have another idea to reproduce, so we can improve the core at this part?
Just to avoid that someone more `waste at least half a day searching for the "error" after an upgrade to v8`... as you mentioned in Slack.

Actions #5

Updated by Gerrit Code Review almost 5 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/+/61122

Actions #6

Updated by Gerrit Code Review almost 5 years ago

Patch set 3 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/+/61122

Actions #7

Updated by Gerrit Code Review over 4 years ago

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

Actions #8

Updated by Gerrit Code Review over 4 years ago

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

Actions #9

Updated by Markus Klein over 4 years ago

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

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF