Bug #4492
ViewHelper render method arguments not initialized/passed correctly
100%
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
Files
Updated by Frans van der Veen almost 13 years ago
Note: I believe this also fixes the following issue:
http://forge.typo3.org/issues/show/4488
Updated by Sebastian Kurfuerst almost 13 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
Updated by Frans van der Veen almost 13 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
Updated by Sebastian Kurfuerst almost 13 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
Updated by Sebastian Kurfuerst almost 13 years ago
- Status changed from New to Accepted
- Assignee set to Sebastian Kurfuerst
- Priority changed from Should have to Must have
Updated by Sebastian Kurfuerst almost 13 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.
Updated by Sebastian Kurfuerst almost 13 years ago
- File patch-4492.diff patch-4492.diff added
updated patch. now with proper unit tests.
Updated by Sebastian Kurfuerst almost 13 years ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r3178.