Hello great community,

Problem/Motivation

I got this error when I entered into the Captcha Examples page

Notice: Undefined variable: type in Drupal\captcha\Form\CaptchaExamplesForm->buildChallenge() (line 108 of modules/contrib/captcha/src/Form/CaptchaExamplesForm.php).
  protected function buildChallenge($module, $challenge) {
    return [
      '#type' => 'captcha',
      '#captcha_type' => $module . '/' . $type,
      '#captcha_admin_mode' => TRUE,
    ];
  }

Proposed resolution

$type variable should be replaced with challenge variable

  protected function buildChallenge($module, $challenge) {
    return [
      '#type' => 'captcha',
      '#captcha_type' => $module . '/' . $challenge,
      '#captcha_admin_mode' => TRUE,
    ];
  }

Thanks

CommentFileSizeAuthor
#2 3091082-2.patch544 bytesahmadhalah
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ahmadhalah created an issue. See original summary.

ahmadhalah’s picture

Please check out this patch

ahmadhalah’s picture

Status: Needs work » Needs review
EricVL’s picture

I had the same issue. Patch in #2 solves it. Thanks

thetaPC’s picture

Patch #2 solves it. Thank you!

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Works for me too.

(Please feel free to set an issue to RTBC if you've tested the patch and you think it fixes the problem :)

ojchris’s picture

pguillard’s picture

RTBC++ !

wundo’s picture

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

  • wundo committed 548a8ba on 8.x-1.x authored by ahmadhalah
    Issue #3091082 by ahmadhalah, thetaPC, EricVL, joachim, pguillard, wundo...
wundo’s picture

Status: Fixed » Closed (fixed)

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

wheelieboy’s picture

Patch #2 works for me too.

ahmadhalah’s picture