This has shown up after I have selected an options list in Component value selectbox in E-mail settings and pressed Add.
Notice: Uninitialized string offset: 0 in webform_email_edit_form() (Zeile 267 von sites/all/modules/webform/includes/webform.emails.inc).
#default_value is line 267:
foreach ($options as $key => $label) {
$form[$field . '_mapping'][$cid][$key] = array(
'#type' => 'textfield',
'#title' => $label,
'#default_value' => is_numeric($email[$field]) && $email[$field] == $cid && isset($email['extra'][$field . '_mapping'][$key]) ? $email['extra'][$field . '_mapping'][$key] : '',
'#attributes' => array('placeholder' => t('email@example.com')),
);
}
Comments
Comment #1
quicksketchThanks, this issue may be related to #2028949: Warning: Invalid argument supplied for foreach() in webform_submission_send_mail(). I'll see if I can reproduce the problem.
Comment #2
hass commentedI tried to reproduce it again one minute later, but failed. I cannot remember what I've done in what order. I haven't had the patch from #2038139: Uninitialized string offset: 0 in webform_email_edit_form() applied.
Comment #3
quicksketchHm, I can't reproduce it either. Let me know if you can figure out way to reproduce this error.
Comment #3.0
quicksketchUpdated issue summary.
Comment #4
marcoscanoAlso happened for me, but only the first time the form was built.
Version 7.x-4.0-beta1, core 7.23
- Created a select element in the form, with different pairs "key|label"
- When was going to create the email mapping using the element created previously, the notices appeared - one for each pair key|label, but all of them with the same message:
Notice: Uninitialized string offset: 0 in webform_email_edit_form() (line 267 of /var/www/html/sites/all/modules/webform/includes/webform.emails.inc).The mapping values are stored correctly, and the following builds of the form are executed correctly, i.e. the notices are not shown.
Don't know if this information helps to investigate the issue further, marking it as active just in case
Also marked #2134355: Error when setting an email address for a webform as duplicate of this one
Comment #5
marcoscanoIt happened again with another form, so I didn't save it (to avoid loosing track of the bug) and could investigate it a bit further. Apparently the problem comes from
isset($email['extra'][$field . '_mapping'][$key])once the $email['extra'] is an empty string at that point and the [] is evaluated before the isset().
Added an additional is_array() to check that before the array evaluation. With this, for me the notices are gone.
Patch attached
Comment #6
quicksketchThanks, works for me! Committed to 7.x-4.x branch.
Comment #7
fenstratCommitted to 8.x-4.x in b68645a. Thanks.
Comment #8
ParisLiakos commentedhttp://drupalcode.org/project/webform.git/commit/b10ffeb contains an unrelated change
http://drupalcode.org/project/webform.git/blobdiff/d0a1fc5ebbc4fb1f4dbf1...
which results to parse error.
can that be rolled back?
Comment #9
ParisLiakos commentedpatch
Comment #10
fenstratGood catch @ParisLiakos. Rolled back in 831de1f.
I also noticed a change in webform.module specifically http://drupalcode.org/project/webform.git/blobdiff/4fca7450413989ceba73a... which came from http://drupalcode.org/project/webform.git/commit/b10ffeb so I also rolled that back (couldn't for the life of me figure out where it came from).
This doesn't apply to 8.x-4.x as it never had the accidental commit.
Comment #11
ParisLiakos commentedyeap, in 8.x-4.x it was committed correctly. Thanks!