Recaptcha error - ReCaptcha\ReCaptcha Class not found
  • Hello,

    Okay first off this is running on localhost so I get a javascript alert: Cannot contact reCAPTCHA. Check your connection and try again.

    Now, if I complete the form; ignoring the Recaptcha and hit submit I get the following error. Where can I find the Recaptcha Class?


    ( ! ) Fatal error: Class 'ReCaptcha\ReCaptcha' not found in /vagrant/html/ on line 148

    A PHP Error was encountered
    Severity: Warning

    Message: Cannot modify header information - headers already sent by (output started at /vagrant/html/

    Filename: core/Common.php

    Line Number: 578


    A PHP Error was encountered
    Severity: Error

    Message: Class 'ReCaptcha\ReCaptcha' not found

    Filename: helpers/forms_helper.php

    Line Number: 148

  • See these issues on GitHub for more references:

    Sounds like you'll need the vendor package installed with composer.
  • Well that's one thing solved.

    The next problem is that if I complete the form, but ignore the Recaptcha I can still submit the form! How do I tell Fuel/CodeIgniter that the Recaptcha is mandatory?
  • The Forms_custom_fields.php file has a recaptcha method in it which is used to render the recaptcha form field. In that method it has a line used to validate the recaptcha on post process:
    $validator->add_rule("recaptcha_response_field", "validate_recaptcha", "'.$params['error_message'].'", array("'.$params['recaptcha_private_key'].'"));
    The "validate_recaptcha" is a function that is in the forms_helper.php file and will return a TRUE boolean value if it is valid. My guess is that there needs to be some adjustment there.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!