Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#2 | 3091082-2.patch | 544 bytes | ahmadhalah |
|
Comments
Comment #2
ahmadhalah CreditAttribution: ahmadhalah as a volunteer and commentedPlease check out this patch
Comment #3
ahmadhalah CreditAttribution: ahmadhalah as a volunteer and commentedComment #4
EricVL CreditAttribution: EricVL commentedI had the same issue. Patch in #2 solves it. Thanks
Comment #5
thetaPCPatch #2 solves it. Thank you!
Comment #6
joachim CreditAttribution: joachim commentedWorks 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 :)
Comment #7
ojchris CreditAttribution: ojchris as a volunteer and commentedWorks! Eliminated the error at this url http://app-d8.local/admin/config/people/captcha/examples and http://app-d8.local/admin/config/people/captcha/examples/captcha/Math
Thank you!
Comment #8
pguillard CreditAttribution: pguillard commentedRTBC++ !
Comment #9
wundo CreditAttribution: wundo at Chuva Inc. commentedComment #10
wundo CreditAttribution: wundo at Chuva Inc. commentedComment #12
wundo CreditAttribution: wundo at Chuva Inc. commentedComment #14
wheelieboy CreditAttribution: wheelieboy commentedPatch #2 works for me too.
Comment #15
ahmadhalah CreditAttribution: ahmadhalah as a volunteer and at iSpectra commented