Bug #84997

Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings

Added by Michael Stopp about 1 year ago. Updated 5 months ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2018-05-14
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you open a localized records, which contains a field of type select and rendertype selectCheckBox, it will produce the following warning, if l10n_display is defaultAsReadonly:

Core: Error handler (BE): PHP Warning: array_flip() expects parameter 1 to be array, string given in [...]\typo3\sysext\backend\Classes\Form\Element\SelectCheckBoxElement.php line 71

SelectCheckBoxElement_8.7.24.patch View (8.83 KB) Michael Stopp, 2019-01-29 18:48

SelectCheckBoxElement_9.5.4.patch View (8.18 KB) Michael Stopp, 2019-01-29 18:48


Related issues

Related to TYPO3 Core - Bug #77257: The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record New 2016-07-26
Related to TYPO3 Core - Bug #87472: PHP warning with checkboxes and l10n_display=defaultAsReadonly New 2019-01-17

History

#1 Updated by Michael Stopp about 1 year ago

  • Related to Bug #77257: The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record added

#2 Updated by Michael Stopp 5 months ago

  • Related to Bug #87472: PHP warning with checkboxes and l10n_display=defaultAsReadonly added

#3 Updated by Michael Stopp 5 months ago

The cause of the warning is described in #87472. The fix proposed by Dmitry will remove the PHP warning, but the element will still not be rendered correctly with the current implementations (8 LTS, 9 LTS).

The $disabled flag (set by $config['readOnly']) will always leave the $groups checkbox array empty and thus the field will never be rendered properly. The disabled property in the items array is hardcoded to false, which makes this ternary operator further below a bit nonsensical:

($item['disabled'] ? 'disabled=disabled ' : '')

I suggest the enclosed patches for a readonly rendering of the SelectCheckBox element (as the defaultAsReadonly option in TCA would suggest...).

Also available in: Atom PDF