--- ./captcha.module.orig 2009-12-08 23:25:19.000000000 +0100 +++ ./captcha.module 2010-01-09 00:44:24.367138298 +0100 @@ -217,7 +217,7 @@ // Generate a CAPTCHA and its solution // (note that the CAPTCHA session ID is given as third argument). $captcha = module_invoke($captcha_type_module, 'captcha', 'generate', $captcha_type_challenge, $captcha_sid); - if (!$captcha) { + if (empty($captcha)) { // The selected module returned nothing, maybe it is disabled or it's wrong, we should watchdog that and then quit. watchdog('CAPTCHA', 'CAPTCHA problem: hook_captcha() of module %module returned nothing when trying to retrieve challenge type %type for form %form_id.', @@ -241,17 +241,16 @@ // Add pre_render callback for additional CAPTCHA processing. $element['#pre_render'] = array('captcha_pre_render_process'); + // Store information for usage in the validation and pre_render phase. + $element['#captcha_info'] = array( + 'form_id' => $this_form_id, + 'module' => $captcha_type_module, + 'type' => $captcha_type_challenge, + 'captcha_sid' => $captcha_sid, + 'solution' => $captcha['solution'], + ); } - // Store information for usage in the validation and pre_render phase. - $element['#captcha_info'] = array( - 'form_id' => $this_form_id, - 'module' => $captcha_type_module, - 'type' => $captcha_type_challenge, - 'captcha_sid' => $captcha_sid, - 'solution' => $captcha['solution'], - ); - return $element; }