_webform_encrypt_decrypt_nested_values() needs to check component validity

Created on 15 August 2013, almost 11 years ago
Updated 28 March 2023, over 1 year ago

I was seeing Warning: Invalid argument supplied for foreach() in element_children() being thrown as a result of _webform_encrypt_decrypt_nested_values() calling itself recursively with $component = NULL.

This was happening with a multi-page form containing fieldsets. When the fieldset is on a non-current page, _webform_client_form_add_component() still processes it provided that it has children (see the end of that function).

When the children also turn out to not be part of the current page (no surprise there), what we're left with is a component for the fieldset with the value NULL, so _webform_encrypt_decrypt_nested_values() picks that up and tries to process it, calling element_children() and generating the error.

This feels like a webform bug, but we can easily protect against it here.

(Cross-referencing with #2065649: NULL parent components on multi-page forms β†’ )

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand jweowu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024