Project

General

Profile

Bug #86890

Updated by Steffen Keuper over 5 years ago

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. 
 !https://i.imgur.com/nWUgBC4.png! 

 Screenshot of the var_dump of $this->tag directly at the top of the render function in the TextfieldViewHelper: 
 !https://i.imgur.com/gZ5jWdd.png! 

 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): 
 <pre><code class="yaml"> 

 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' 
 </code></pre> 

 I solved it in my local instance by moving 
 <pre><code class="php"> 
 $this->setTagBuilder(new TagBuilder($this->tagName)); 
 </code></pre> 
 from the __construct function into the initialize function in \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper but I'm not sure if this is the right approach. 

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

Back