cforms2 icon indicating copy to clipboard operation
cforms2 copied to clipboard

PHP Notice of lib_render.php

Open wdfee opened this issue 8 years ago • 4 comments

Hi bgermann, I got a php notice in mode: "Notice: Undefined offset: 1 in [mypath]/plugins/cforms2/lib_render.php on line 752" Just put on emore conditional to it, removes it if (isset($radioPreset[1]) && strpos($radioPreset[1], 'true') !== false)

...using development version, downloaded master today.

wdfee avatar Jul 07 '17 10:07 wdfee

I got some more notices on another form:

Notice: Undefined index: cforms2_count_field_19 in [mypath]/plugins/cforms2/lib_validate.php on line 489

when I put this condition in line 488: if (!$custom && isset($cformsSettings['form' . $no]['cforms' . $no . '_count_field_' . $i])) it results in another notice:

Notice: Undefined offset: 18 in [mypath]/plugins/cforms2/lib_validate.php on line 491

But I don't have a patch for that now. Just inserting more conditions results in memory exhausted.

Btw please don't forget to tell your users on the next update, that they have to save the forms again, and have to re-insert them via the editor button or shortcode.

wdfee avatar Jul 07 '17 12:07 wdfee

How many fields do you have in the form that you referenced in your 2nd post? I guess you have 18 fields.

bgermann avatar Jul 12 '17 13:07 bgermann

exactly

wdfee avatar Jul 12 '17 14:07 wdfee

ok, coming back to this issue, in current version 15.0.3. I solved it by changing lines 422-431 in lib_validate.php to:

if (!$custom && isset($cformsSettings['form' . $no]['cforms' . $no . '_count_field_' . $i])) {
    $field_stat = explode('$#$', $cformsSettings['form' . $no]['cforms' . $no . '_count_field_' . $i]);
    $field_stat[] = "";
} elseif(isset($customfields[$i - 1])) {
    $field_stat = explode('$#$', $customfields[$i - 1]);
    $field_stat[] = "";
} else {
    // all fields searched, break both while & for
    break 2;
}

wdfee avatar Apr 30 '20 15:04 wdfee