In #2874151: Captcha + Panels + Page Manager + Webform : The answer you entered for the CAPTCHA was not correct. and #3061067: Captcha-answer=hash value? the same issue was fixed by a different approach, both patches were committed. This results in the return of the issue.

For forms with a form ID containing a dash and the form containing a CAPTCHA element, the provided answer always is not correct, because the solution is reset when the stored form ID and submitted/posted form ID do not match.

The form IDs are 'cleaned' by a regex, which regex is different in both places:

Posted form ID:

    $posted_form_id = isset($input['form_id']) ?
      preg_replace("/[^a-z0-9_-]/", "", (string) $input['form_id'])
      : NULL;

Stored form ID:

    $this_form_id = isset($complete_form['form_id']['#value']) ?
      preg_replace("/[^a-z0-9_]/", "", (string) $complete_form['form_id']['#value'])
      : NULL;

Will provide a patch shortly.

Comments

sjerdo created an issue. See original summary.

sjerdo’s picture

Status: Active » Needs review
StatusFileSize
new682 bytes
sjerdo’s picture

Assigned: sjerdo » Unassigned
adamps’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch, that works for me.

This is a nasty bug that can make significant parts of a site unusable so it would be great to get it committed.

lamp5’s picture

Thx, the patch works perfect!

  • japerry committed 162bb5d on 8.x-1.x authored by sjerdo
    Issue #3152792 by sjerdo: Solution is reset for form IDs containing a...
japerry’s picture

Status: Reviewed & tested by the community » Fixed
adamps’s picture

Great thanks

Status: Fixed » Closed (fixed)

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