Issue Bug Closed

#91833When form option has label equals to 0 (zero), it's replaced by the empty string

Jiří Štefl 07/21/20, 13:42 updated 10/04/22, 14:12

Description

Steps to reproduce:

  1. Create a new form in the backend wizard.
  2. Create a radio button element (eg Number of children) in this form with options: 0, 1, 2, 3 (same label & value).

Current result:

In the frontend the first option has an empty string as the label.

Expected result:

The first option has ‘0’ as the label.

Problem:

There are “empty variable” conditions in TYPO3\CMS\Form\Service\TranslationService->translateFormElementValue() on lines 364 & 368. This will be true if the string is empty or equal to ‘0’ (https://www.php.net/manual/en/function.empty.php).

Solution:

Change conditions to:

(empty($defaultValue) && $defaultValue !== '0')

Reviews 1