Skip to content

PHP - 8.4 Deprecated Functionality: ReCaptcha\ReCaptcha::__construct() #576

@pratikvs

Description

@pratikvs

Hi,

This library does not support PHP8.4. The issue lies in the file g
oogle/recaptcha/src/ReCaptcha/ReCaptcha.php
where a ? should be addeed before the parameter RequestMethod $requestMethod = null in the second argument of the constructor. Please note the below patch for this.

`--- Patch/ReCaptcha.php 2025-05-26 11:53:22.470368105 +0530
+++ vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php 2025-05-22 16:12:51.219561321 +0530
@@ -136,7 +136,7 @@
* @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
* @throws \RuntimeException if $secret is invalid
*/

  • public function __construct($secret, ? RequestMethod $requestMethod = null)
  • public function __construct($secret, RequestMethod $requestMethod = null)
    {
    if (empty($secret)) {
    throw new \RuntimeException('No secret provided');
    `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions