Project

General

Profile

Actions

Bug #89152

closed

renderType='selectTree' generates warning with single value select

Added by Thomas Luzat over 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2019-09-11
Due date:
% Done:

100%

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

Description

When configuring a 'select' field like this:

'config' => [
'minitems' => 1,
'maxitems' => 1,
'type' => 'select',
'renderType' => 'selectTree',
'foreign_table' => 'foo',
'treeConfig' => [
'parentField' => 'parent',
],
],

... TYPO3 9.5.9 (and probably 8, possibly 10) generates a warning (which may be converted to an exception) when rendering the tree in the backend:

PHP Warning: implode(): Invalid arguments passed in /var/www/htdocs/web/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php line 164

This was introduced earlier in 2019 with 18411d12528454d1b71574da5a86837bc11e189e: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60415

Changing the line

$html[] = ' value="' . htmlspecialchars(implode(',', $parameterArray['itemFormElValue'])) . '"';

to

$html[] = ' value="' . htmlspecialchars(is_array($parameterArray['itemFormElValue']) ? implode(',', $parameterArray['itemFormElValue']) : $parameterArray['itemFormElValue']) . '"';

seems to reasonably fix the case here.


Files


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #86954: Categories are lost, when saving before category tree is loaded completelyClosed2018-11-20

Actions
Related to TYPO3 Core - Bug #96095: BackendLayoutWizard can not handle readOnlyClosedOliver Bartsch2021-11-26

Actions
Related to TYPO3 Core - Bug #96096: InputSlugElement can not handle readOnlyClosedOliver Bartsch2021-11-26

Actions
Related to TYPO3 Core - Bug #91852: 'l10n_display' => 'defaultAsReadonly' not working with mm tableClosed2020-07-23

Actions
Actions #1

Updated by Thomas Luzat over 4 years ago

  • Related to Bug #86954: Categories are lost, when saving before category tree is loaded completely added
Actions #2

Updated by Georg Ringer about 4 years ago

  • Status changed from New to Needs Feedback

I tested that on current master (10.4) and can't reproduct that, itemFormElValue is always an array. can you recheck master as well if it is fixed.

I used

$GLOBALS['TCA']['pages']['columns']['categories']['config'] = [
    'minitems' => 1,
    'maxitems' => 1,
    'type' => 'select',
    'renderType' => 'selectTree',
    'foreign_table' => 'foo',
    'treeConfig' => [
        'parentField' => 'parent',
    ],
];
Actions #3

Updated by Tim Karliczek over 3 years ago

In TYPO3 9.5.21 and 10.4.8 i am able to force the same error with a different TCA.

In your extension create extension_name/Configuration/TCA/Overrides/tt_content.php file with the following content:

<?php
defined('TYPO3_MODE') or die();

$GLOBALS['TCA']['tt_content']['columns']['categories']['l10n_mode'] = 'exclude';
$GLOBALS['TCA']['tt_content']['columns']['categories']['l10n_display'] = 'defaultAsReadonly';

Now create a new content element, translate the page, switch to the list module, translate the content element by clicking on the "localize to" icon.
Depending on your error level the following Exception is thrown:

PHP Warning: implode(): Invalid arguments passed in /var/www/html/public/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php line 168

I think the above TCA config is a valid use case. For strict translations it makes no sense to allow the editor to choose other categories in the translation.

Actions #4

Updated by Vladimir Falcon about 3 years ago

I was able to reproduce this error.

TYPO3 10.4.14
PHP 7.4

PHP Warning
Core: Error handler (BE): PHP Warning: implode(): Invalid arguments passed in /var/www/html/app/web/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php line 168

Steps:

1. Extended pages table with a new field for category records.
2. Set TCA options renderType = selectTree, l10n_mode = exclude and l10n_display = defaultAsReadonly.
3. Add some categories
4. Create a new page and select one or more categories.
5. Localize the previously created page.

Attached a patch to fix this problem

Actions #5

Updated by Gerrit Code Review over 2 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/+/72275

Actions #6

Updated by Gerrit Code Review over 2 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/+/72275

Actions #7

Updated by Gerrit Code Review over 2 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/+/72275

Actions #8

Updated by Gerrit Code Review over 2 years ago

Patch set 4 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/+/72275

Actions #9

Updated by Gerrit Code Review over 2 years ago

Patch set 5 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/+/72275

Actions #10

Updated by Gerrit Code Review over 2 years ago

Patch set 6 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/+/72275

Actions #11

Updated by Gerrit Code Review over 2 years ago

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

Actions #12

Updated by Gerrit Code Review over 2 years ago

Patch set 8 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/+/72275

Actions #13

Updated by Gerrit Code Review over 2 years ago

Patch set 9 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/+/72275

Actions #14

Updated by Gerrit Code Review over 2 years ago

Patch set 10 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/+/72275

Actions #15

Updated by Gerrit Code Review over 2 years ago

Patch set 11 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/+/72275

Actions #16

Updated by Gerrit Code Review over 2 years ago

Patch set 12 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/+/72275

Actions #17

Updated by Gerrit Code Review over 2 years ago

Patch set 13 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/+/72275

Actions #18

Updated by Gerrit Code Review over 2 years ago

Patch set 14 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/+/72275

Actions #19

Updated by Gerrit Code Review over 2 years ago

Patch set 15 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/+/72275

Actions #20

Updated by Gerrit Code Review over 2 years ago

Patch set 16 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/+/72275

Actions #21

Updated by Oliver Bartsch over 2 years ago

  • Related to Bug #96095: BackendLayoutWizard can not handle readOnly added
Actions #22

Updated by Oliver Bartsch over 2 years ago

  • Related to Bug #96096: InputSlugElement can not handle readOnly added
Actions #23

Updated by Gerrit Code Review over 2 years ago

Patch set 17 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/+/72275

Actions #24

Updated by Gerrit Code Review over 2 years ago

Patch set 18 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/+/72275

Actions #25

Updated by Gerrit Code Review over 2 years ago

Patch set 19 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/+/72275

Actions #26

Updated by Gerrit Code Review over 2 years ago

Patch set 20 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/+/72275

Actions #27

Updated by Gerrit Code Review over 2 years ago

Patch set 21 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/+/72275

Actions #28

Updated by Gerrit Code Review over 2 years ago

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

Actions #29

Updated by Oliver Bartsch over 2 years ago

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

Updated by Oliver Bartsch over 2 years ago

  • Related to Bug #91852: 'l10n_display' => 'defaultAsReadonly' not working with mm table added
Actions #31

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF