Project

General

Profile

Actions

Bug #67098

closed

Bug in TextfieldViewHelper for "required" tag

Added by Markus Hölzle over 9 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2015-05-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

There is a major bug in the TextfieldViewHelper (namespace TYPO3\CMS\Fluid\ViewHelpers\Form):
The parameter "required" will be casted as boolean:

    /**
     * Renders the textfield.
     *
     * @param bool $required If the field is required or not
     * @param string $type The field type, e.g. "text", "email", "url" etc.
     * @return string
     * @api
     */
    public function render($required = NULL, $type = 'text') {

But in the comparison the parameter is checked if it is not NULL:
if ($required !== NULL) {
    $this->tag->addAttribute('required', 'required');
}

So it is no matter if you call the function with "required = FALSE" or "required = TRUE", because both is not "NULL".

This should be:

    public function render($required = FALSE, $type = 'text') {

if ($required !== FALSE) {
    $this->tag->addAttribute('required', 'required');
}


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #67225: CheckboxViewHelper checked attributeClosedFrederic Gaus2015-06-01

Actions
Actions #1

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40645

Actions #2

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40645

Actions #3

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40645

Actions #4

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40645

Actions #5

Updated by Gerrit Code Review over 9 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40645

Actions #6

Updated by Frederic Gaus over 9 years ago

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

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF