Project

General

Profile

Actions

Bug #104834

closed

Possible PHP warning with checkboxToggle

Added by Xavier Perseguers 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Category:
FormEngine aka TCEforms
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 #1

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

Actions #2

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

Actions #3

Updated by Anonymous 3 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

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

Actions #5

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

Actions #6

Updated by Anonymous 3 months ago

  • Status changed from Under Review to Resolved
Actions #7

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF