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

Created on 12 May 2020, over 4 years ago
Updated 4 September 2024, 2 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 10 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.

  • 🇦🇺Australia asdinnie

    Hi

    The error in forms has now reappeared when a non-authorised user submits a form.

    Just upgraded to ReCaptcha 8.x-3.4 under Drupal 10.3.2
    Running Ludwig 2.0.7 & CAPTCHA 8.x-1.15

    I am still installing modules via Drupal...
    Will have to upgrade to Composer sometime but it's a major pain as it's a shared server (home directory cannot be changed, etc.).

    The following error whenever a form is submitted:
    Error: Interface "ReCaptcha\RequestMethod" not found in include() (line 13 of /home/progres1/public_html/modules/recaptcha/src/ReCaptcha/RequestMethod/Drupal8Post.php).

    The original lines in ludwig.json are present:

    {
      "require": {
        "google/recaptcha": {
          "version": "v1.2.4",
          "url": "https://github.com/google/recaptcha/archive/1.2.4.zip"
        }
      }
    }

    Ludwig Packages tells me that google/recaptcha is downloaded.

    Have I missed something?

    Many thanks,
    Andrew

  • 🇵🇭Philippines Alex Oliver Perez

    Solution in #76 worked for me with Drupal core 10.3.2 and reCAPTCHA 8.x-3.4

  • 🇦🇺Australia asdinnie

    Hi Alex

    Thanks very for the note.
    It now works!

    Pity it doesn't stay like that after each upgrade...

    Much appreciated,

    Andrew

  • 🇭🇷Croatia devad

    Re: #81+

    The patch #2 in the new added related issue should help. Please test.

Production build 0.71.5 2024