dachcom-digital / pimcore-formbuilder

Pimcore Formbuilder - create forms easily!
Other
92 stars 47 forks source link

[BUG] - Formbuilder Fieldset Fields with API Channel produced "Undefined array key - type" error #423

Closed erikjewel closed 10 months ago

erikjewel commented 1 year ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Hi Dachcom-Digital Team, we have occurred a bug on Formbuilder version 4.5. Our Form contain two fields which are encapsulated into fieldset container, like in figure 1 below. As Output Worklfow, we using an API Channel which send data to an extern System. When we trying to send the form in Frontend, we catch an error about array key, also see figure 2. After debugging we have found, that the childs of an fieldset are not used in a loop as flat array, but as a branch of arrays, which produced such kind of problems. For that i have take a Screenshot of Code (figure 3) where the error occurres. In the line 123 i have included temporarily a fix for testing measures. Will be grateful, when this fix comes as update from your side.

Screenshots:

Bildschirm­foto 2023-10-30 um 11 23 39

Fig. 1 - Supposed error code block

Bildschirm­foto 2023-10-30 um 11 21 43

Fig. 2 - Form structure

Bildschirm­foto 2023-10-30 um 10 53 59

Fig. 3 - Frontend form error message

Thanks and best regards!

solverat commented 10 months ago

Using the null coalescing operator is enough since we're checking for a valid type reference later on:

https://github.com/dachcom-digital/pimcore-formbuilder/blob/564e778bf2919004a37d82d631149af2f977182e/src/OutputWorkflow/Channel/Api/ApiOutputChannelWorker.php#L182

Fixed in 4.5.1 and 5.0.3