Issue Bug Closed

#103162The f:form ViewHelper can not handle arrays as object attribute anymore

Philipp Wrann 02/20/24, 15:51 updated 10/15/24, 09:30

Description

Before adding strict types in V12 the <f:form> ViewHelper could be utilized with arrays as object attribute values.</f:form>

<f:form objectName="q" object="{array}">

Since V12 this will throw a TypeError because the method signature of the AbstractFormViewHelper has changed and does only allow ?object parameters, which is not consistent with the viewhelper argument type (mixed), that does not implicitly say, that arrays are not to be used.

I personally often utilize the <f:form> viewhelper with arrays to handle simple search forms, because it will produce correct argument names for the form fields. If i would instead use a simple html <form> i would have to make sure to name all of my fields correctly. <p>IMO the parameter type should be changed from ?object to object|array|null</p> <p>Unions are possible since PHP 8.0</p></form></f:form>

Reviews 2