Download & Extend

notice: Undefined index: captcha_response

Project:CAPTCHA
Version:6.x-2.x-dev
Component:Captcha API (captcha)
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I am using drupal 6 DEV sept 23 and the latest captcha module with latest recaptcha module add-on on a contact form. I get the following error after submitting:

notice: Undefined index: captcha_response in /home/content/m/o/d/modoggieweb/html/modules/captcha/captcha.module on line 333.

Comments

#1

Version:6.x-1.x-dev» 6.x-2.x-dev

I confirm this bug with 6.x-1.x. This part of the code is similar in the dev version, so upping.
I am having this problem with captach + recaptcha.

The code has:

<?php
function captcha_validate($form, &$form_state) {
 
// Get answer and preprocess if needed
 
$captcha_response = $form_state['values']['captcha_response'];

 
// ...

 
$captcha_response = module_invoke($captcha_info['module'], 'captcha', 'preprocess', $captcha_info['type'], $captcha_response);
?>

However, $form_state['values'] at this stage is (on a user registration form):

Array
(
    [name] => test
    [mail] => aeu@example.com
    [timezone] => 28800
    [op] => Create new account
    [submit] => Create new account
    [form_build_id] => form-207c4f069b1af6bcb3a6fe7fbae6ac97
    [form_id] => user_register
    [captcha_solution] => 1
    [captcha_token] => 1a17561b2d6584c1be095c391f846adc
    [captcha_info] => Array
        (
            [form_id] => user_register
            [preprocess] => 1
            [module] => recaptcha
            [type] => reCAPTCHA
        )

)

So, what is it supposed to be?

#2

To be clear: I have been able to reproduce this bug on the latest dev version, so the bug applies to the two branches, but on line 313 in the active dev branch.

#3

I solved the issue for now by using the following code:

<?php
  $captcha_response
= NULL;
  if (!empty(
$form_state['values']['captcha_response'])) {
   
$captcha_response = $form_state['values']['captcha_response'];
  }
?>

but I don't know this module enough to know if it's the proper approach, since captcha_response is not referenced anywhere in the form value. Is it supposed to be something else?

#4

#5

Component:Code» Captcha API (captcha)
Status:active» postponed (maintainer needs more info)

Not much time to review this thoroughly, but captcha_response is a field that should be defined by the module that implements the challenge.

So important question is: what challenge type are you using?

#6

Status:postponed (maintainer needs more info)» active

As mentioned in #1, I am having this problem with captach + recaptcha.

#7

Status:active» fixed

This issue seems to be fixed with the latest version CAPTCHA 6.x-2.x-dev and reCAPTCHA.

please reopen if you're still experiencing the same problem

#8

Status:fixed» closed (fixed)

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

nobody click here