Bug #4492

ViewHelper render method arguments not initialized/passed correctly

Added by Frans van der Veen over 10 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
-
Target version:
-
Start date:
2009-09-08
Due date:
% Done:

100%

Has patch:

Description

Hi,

Tx_Fluid_Core_ViewHelper_AbstractViewHelper::prepareArguments initializes arguments in the wrong order, or so it appears. This causes the arguments passed to the render() method not having any value.

First registerRenderMethodArguments is called (which set the flag isMethodParameter for the arguments), then initializeArguments is called, which if it has arguments with the same name will overwrite the arguments created by registerRenderMethodArguments.

You can test by changing the 'value' or 'name' parameter in a form.submit tag:
<f:form.submit value="Gogogo!" />

Solution: change the order in which initializeArguments and registerRenderMethodArguments() are called in Tx_Fluid_Core_ViewHelper_AbstractViewHelper::prepareArguments.
(It appears to be working for the form.submit ViewHelper when I do so)

Regards,

Frans

patch-4492.diff View (3.68 KB) Sebastian Kurfuerst, 2009-09-15 19:57

Associated revisions

Revision 255e04ba (diff)
Added by Sebastian Kurfuerst over 10 years ago

[+BUGFIX] Fluid (Core): Made sure that ViewHelper arguments can not be re-declared with the same name. Resolves #4492.
[+BUGFIX] Fluid (ViewHelpers): Fixed the Form Submit ViewHelper. Now, Name and Value are used correctly. Resolves #4488.

History

#1 Updated by Frans van der Veen over 10 years ago

Note: I believe this also fixes the following issue:
http://forge.typo3.org/issues/show/4488

#2 Updated by Sebastian Kurfuerst over 10 years ago

  • Project changed from Extbase MVC Framework to TYPO3.Fluid

#3 Updated by Sebastian Kurfuerst over 10 years ago

Hi Frans,

currently I'd rather like to add a check that if one tries to register the same argument multiple times, he gets an error. Because else, the behavior is undefined...

Is this fine with you?

Greets,
Sebastian

#4 Updated by Frans van der Veen over 10 years ago

Hi Sebastian,

Great idea! Undefined behaviour is bad :)

Please note that the Tx_Fluid_ViewHelpers_Form_AbstractFormFieldViewHelper registers the name and value argument per default, so the Tx_Fluid_ViewHelpers_Form_SubmitViewHelper will have to handle the arguments differently in the render() method.

Thanks.

Regards,
Frans

#5 Updated by Sebastian Kurfuerst over 10 years ago

Hey,

Please note that the Tx_Fluid_ViewHelpers_Form_AbstractFormFieldViewHelper registers the name and value argument per default, so the Tx_Fluid_ViewHelpers_Form_SubmitViewHelper will have to handle the arguments differently in the render() method.

You are totally right! Seems we've forgotten about this one.

I'll handle this error tomorrow.

Greets,
Sebastian

#6 Updated by Sebastian Kurfuerst over 10 years ago

  • Status changed from New to Accepted
  • Assignee set to Sebastian Kurfuerst
  • Priority changed from Should have to Must have

#7 Updated by Sebastian Kurfuerst over 10 years ago

  • File patch-4492.diff added

the attached patch should solve the issue. I added a check which throws an exception. will commit after bastian has fixed the submitviewhelper tomorrow.

#8 Updated by Sebastian Kurfuerst over 10 years ago

  • File deleted (patch-4492.diff)

#9 Updated by Sebastian Kurfuerst over 10 years ago

updated patch. now with proper unit tests.

#10 Updated by Sebastian Kurfuerst over 10 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3178.

Also available in: Atom PDF