Actions
Bug #104834
closedPossible PHP warning with checkboxToggle
Status:
Closed
Priority:
Should have
Assignee:
Category:
FormEngine aka TCEforms
Target version:
Start date:
2024-09-05
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:
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.
Actions