Bug #104834
closedPossible PHP warning with checkboxToggle
100%
Description
Under some circumstance, it's possible that 'items' has been omitted in the TCA definition and this causes a PHP warning with that block:
// Traversing the array of items $items = $this->data['parameterArray']['fieldConf']['config']['items']; $numberOfItems = count($items); if ($numberOfItems === 0) { $items[] = ['label' => '']; $numberOfItems = 1; }
Since there is already a proper check and fallback for emptiness, the null coalescing operator should be used as well in the first place:
$items = $this->data['parameterArray']['fieldConf']['config']['items'] ?? [];
Problem has been spotted in TYPO3 v11 already but code hasn't changed in v12.
Updated by Gerrit Code Review 3 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/+/85900
Updated by Gerrit Code Review 3 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/+/85878
Updated by Anonymous 3 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f8accf52c184009fef6e4d52bef8a991fc35fcb2.
Updated by Gerrit Code Review 3 months ago
- Status changed from Resolved to Under Review
Patch set 2 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/+/85878
Updated by Gerrit Code Review 3 months ago
Patch set 3 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/+/85878
Updated by Anonymous 3 months ago
- Status changed from Under Review to Resolved
Applied in changeset fd712a3bdd112cee7062eb9295064df5e735fd72.