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

beginner’s picture

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:

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?

beginner’s picture

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.

beginner’s picture

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

  $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?

beginner’s picture

soxofaan’s picture

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?

beginner’s picture

Status: Postponed (maintainer needs more info) » Active

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

soxofaan’s picture

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

Status: Fixed » Closed (fixed)

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