Error: Class 'ReCaptcha\ReCaptcha' not found in recaptcha_captcha_validation() (line 162

Created on 12 May 2020, about 4 years ago
Updated 21 January 2024, 5 months ago

So we are using this recaptcha module on our contact form to show the Google Recaptcha (checkbox one). As soon as someone fills in the form and submits the page crashes and submission is not made. Logs show this error:

Error: Class 'ReCaptcha\ReCaptcha' not found in recaptcha_captcha_validation() (line 162 of /srv/bindings/60c14a3de43141b691621309dd11eca8/code/modules/contrib/recaptcha/recaptcha.module)

💬 Support request
Status

Closed: outdated

Version

3.0

Component

reCAPTCHA V3

Created by

🇵🇰Pakistan Ahmed.Raza

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia dalpasso

    Variation of #5 and #24 worked for me with D9.5.10, recaptcha 8.x-3.2:

    Added these lines to recaptcha.module after the last use statement:

    require_once dirname(__FILE__) . '/src/ReCaptcha/ReCaptcha.php';
    require_once dirname(__FILE__) . '/src/ReCaptcha/RequestMethod.php';
    require_once dirname(__FILE__) . '/src/ReCaptcha/RequestParameters.php';
    require_once dirname(__FILE__) . '/src/ReCaptcha/Response.php';

    Copied these class files from version: v8.x-3.1 of the module into recaptcha/src/ReCaptcha/

  • 🇸🇰Slovakia lubwn

    Solution from #61 worked for me. Installing with composer command solved the issue:

    composer require 'drupal/recaptcha:^3.0'

    I have older Drupal 8.9.x website where update would be problematic so I installed recaptcha at first by hand, but came across this error.

    I duplicated composer.json file somewhere locally, run the command, copied vendor directory to live website and it started to work.

  • 🇺🇸United States dianacastillo Miami

    the solution in #76 worked for me , added the google directory into vendor directory and then added those lines to the recaptcha module as well as the files he includes in the zip to the src/recaptcha directory

  • 🇮🇹Italy Idas Torino

    Same error for me with Drupal 10 and the latest version of this module.

  • Status changed to Closed: outdated 5 months ago
  • 🇭🇷Croatia devad

    RE: #79

    The Ludwig integration is added recently ✨ reCAPTCHA - Ludwig integration Fixed , so the latest 8.x-3.x-dev can be installed with Ludwig as well. Of course, the Composer is highly recommended whenever possible.

    I believe this issue can be closed as outdated. If you have a proper Composer installation or the proper Ludwig + reCAPTHA 8.x-3.x-dev installation and you still experience this issue please feel free to reopen.

Production build 0.69.0 2024