Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The errors are along the lines of:
Notice: Undefined index: 6 in webform_submission_send_mail() (line 253 of includes/webform.submissions.inc).
Warning: Invalid argument supplied for foreach() in webform_submission_send_mail() (line 253 of includes/webform.submissions.inc).
In this instance component 6 is a checkbox labelled "Email me a copy of this message" with the value "Yes" if the user ticks it.
In the email settings this component is chosen as the "To address", and then the value "Yes" is mapped to the submission value token for a separate email_address
email component, which the user is required to have filled in ([submission:values:email_address]
).
This works nicely, except that when the user doesn't tick the box, no value exists for that value, and the mapping code generates a PHP notice.
Comment | File | Size | Author |
---|---|---|---|
#1 | webform-email_mapping_missing_value-2137699-1.patch | 689 bytes | jweowu |
Comments
Comment #1
jweowu CreditAttribution: jweowu commentedComment #2
quicksketchThanks, great catch. I think this had primarily been tested with select lists rather than checkboxes, and since a single checkbox isn't going to put anything in POST, I can see how this would happen. Committed. Thanks!
Comment #4
fenstratNeeds porting to 8.x-4.x.
Comment #5
fenstratCommitted and pushed 0f59a09 to 8.x-4.x. Thanks!