Bug #84997
closedLocalized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings
100%
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
Files
Updated by Michael Stopp over 6 years 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
Updated by Michael Stopp almost 6 years ago
- Related to Bug #87472: PHP warning with checkboxes and l10n_display=defaultAsReadonly added
Updated by Michael Stopp almost 6 years ago
- File SelectCheckBoxElement_8.7.24.patch SelectCheckBoxElement_8.7.24.patch added
- File SelectCheckBoxElement_9.5.4.patch SelectCheckBoxElement_9.5.4.patch added
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...).
Updated by Gerrit Code Review over 4 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/+/63722
Updated by Gerrit Code Review over 4 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/+/63722
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset a8913dbe2fcf9676153d4036acde7df4cd12681b.
Updated by Gerrit Code Review over 4 years ago
- Status changed from Resolved to Under Review
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/+/63977
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
Applied in changeset ae8172cef8ed304dea48c2b1facf54a03ec87206.