#104834Possible PHP warning with checkboxToggle
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.
Reviews 2
History 37
-
Gerrit Code Review pushed patch set 1 for main to change 85900 status
NewUnder Review 09/05/24, 13:33 -
Gerrit Code Review pushed patch set 1 for 12.4 to change 85878 09/05/24, 16:25
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % 09/05/24, 16:30 -
Gerrit Code Review pushed patch set 2 for 12.4 to change 85878 status
ResolvedUnder Review 09/05/24, 16:48 -
Gerrit Code Review pushed patch set 3 for 12.4 to change 85878 09/05/24, 16:49
-
Anonymous commented and changed status
Under ReviewResolved 09/05/24, 17:05Applied in changeset commit:fd712a3bdd112cee7062eb9295064df5e735fd72.
-
Benni Mack changed status
ResolvedClosed 10/15/24, 09:06
Applied in changeset commit:f8accf52c184009fef6e4d52bef8a991fc35fcb2.