Notice: Uninitialized string offset: 0 in _webform_render_email() (line 140 of ../webform/components/

In 4.x when using the Save Draft button the above error shows up for email (and also textarea) components if their value is empty.

#1 1702948-1-save_draft_notice.patch782 bytesfenstrat
Members fund testing for the Drupal project. Drupal Association Learn more


fenstrat’s picture

Status: Active » Needs review
782 bytes

Attached patch fixes the notice. I checked all other components, only these two use isset($value) and not isset($value[0]).

This only happens on the first page reload after using the Save Draft button. This is because $value is a string (not an array). So if 'test' was submitted in textarea then $value = 'test' directly after submitting with Save Draft. However reloading the page $value = array(0 => 'test') and hence no PHP notice. Odd thing that this isn't an issue on 3.x. Perhaps due to the changes introduced in submission structure?

quicksketch’s picture

Status: Needs review » Fixed

Thanks, sounds like a safe and easy improvement. Let's continue the more difficult problem solving over in #1704158: Nested components do not display saved draft values. Committed to 4.x branch (sorry still no official Git attribution, I'll look into Dreditor again, last time I tried it things went poorly).

fenstrat’s picture

Great, thanks @quicksketch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.