Actions
Bug #91833
closedWhen form option has label equals to 0 (zero), it's replaced by the empty string
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2020-07-21
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:
Remote Sprint
Description
Steps to reproduce:¶
- Create a new form in the backend wizard.
- 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')
Actions