Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RuslanP created an issue. See original summary.

Ruslan Piskarov’s picture

Attaching the patch. Thank you.

jrockowitz’s picture

Thanks for the patch.

Can you provide an example webform that replicates this issue? I am not sure how to trigger the problem.

Because the $lines was just looped-thru we need to make sure the last key exists. Please see the attached patch.

Ruslan Piskarov’s picture

Hello @jrockowitz.
Your patch will not work. It happens for not-required fields, and if $lines is empty. Since removing "
" happens outside of the loop - $key might have not been defined.
In my previous patch $key it is a new variable `$key = key($lines);`, not from the loop.
I will provide the additional screenshots for betting understanding.

With your patch still PHP notices because undefined $key.
3029942-1.jpg

Because $lines can be empty.
3029942-2.jpg

If also can add "if (!empty($lines)) {" but it is not necessary because foreach skips the empty arrays. So I am thinking the patch #2 the best for now.

Ruslan Piskarov’s picture

Status: Needs review » Needs work
Ruslan Piskarov’s picture

Sorry if you are confused, in a hurry I made patches from the wrong place.
Providing the alternative patch, however still thinking the patch #2 the best for now.

jrockowitz’s picture

I think the patch can be as simple as returning an empty string when the $lines are empty.

Please review the attached patch.

andrey.troeglazov’s picture

Status: Needs review » Reviewed & tested by the community

Hello,
I have checked the patch from comment #9, it works for me.
Marking as RTBC.

Ruslan Piskarov’s picture

Agree with #9.

  • jrockowitz committed 3584d1f on 8.x-5.x
    Issue #3029942 by RuslanP, jrockowitz, andrey.troeglazov: Submissions...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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