Issue Bug Closed

#86890AbstractTagBasedViewHelper recycles the TagBuilder

Steffen Keuper 11/08/18, 19:34 updated 05/07/19, 12:15

Description

The same ViewHelper instance is used for multiple generations of Tags in \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper.
This causes arguments like required to get set in the generated HTML even though it wasn’t set in the ViewHelper call.
As a result I’m getting required fields which shouldn’t be required and aren’t marked like required either.

Screenshot of the var_dump of $this->tag directly at the top of the render function in the TextfieldViewHelper:

It only occurred in 30-50% of the cases when I first accessed the page after clearing the cache in the Install Tool for which I have no possible explanation.

I made a simple test form to reproduce this bug(form fields after the first required field also get the required tag even though they may not be required):


renderingOptions:
  submitButtonLabel: Submit
type: Form
identifier: testForm
label: 'Test Form'
prototypeName: standard
renderables:
  -
    renderingOptions:
      previousButtonLabel: 'Previous step'
      nextButtonLabel: 'Next step'
    type: Page
    identifier: page-1
    label: Step
    renderables:
      -
        type: GridRow
        identifier: gridrow-1
        label: 'Grid: Row'
        renderables:
          -
            defaultValue: ''
            type: Text
            identifier: text-1
            label: 'Text 1'
            validators:
              -
                identifier: NotEmpty
            properties:
              fluidAdditionalAttributes:
                required: required
                placeholder: 'text 1'
          -
            defaultValue: ''
            type: Text
            identifier: text-2
            label: Text
            properties:
              fluidAdditionalAttributes:
                placeholder: 'text 2'
      -
        type: GridRow
        identifier: gridrow-2
        label: 'Grid: Row'
        renderables:
          -
            defaultValue: ''
            type: Text
            identifier: text-3
            label: Text
            properties:
              fluidAdditionalAttributes:
                placeholder: 'text 3'
          -
            defaultValue: ''
            type: Text
            identifier: text-4
            label: Text
            properties:
              fluidAdditionalAttributes:
                placeholder: 'text 4'
                required: required
            validators:
              -
                identifier: NotEmpty
      -
        type: GridRow
        identifier: gridrow-3
        label: 'Grid: Row'

I also couldn’t reproduce the bug directly with Fluid templates which is why I decided to use the Form Framework Category.

Reviews 2