Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument 2 passed to ReCaptcha\ReCaptcha::__construct() must be an instance of ReCaptcha\RequestMethod, instance of ReCaptcha\RequestMethod\Curl given #80

Closed
unrivaledcreations opened this issue Nov 6, 2015 · 2 comments

Comments

@unrivaledcreations
Copy link

I encountered this interesting error with recaptcha while developing for Silex (Symfony2). The error reads:

Catchable fatal error: Argument 2 passed to ReCaptcha\ReCaptcha::__construct() must be an instance of ReCaptcha\RequestMethod, instance of ReCaptcha\RequestMethod\Curl given

The error is caused by:
$recaptcha = new \ReCaptcha\ReCaptcha( CAPTCHA_SECRET_KEY, new \ReCaptcha\RequestMethod\Curl() );

The fix is to modify the class definition, google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php:
Original:

class Curl
{...}

Fixed:

class Curl extends Post
{...}

It appears that it must either "implements RequestMethod" or "extend" something that does.

@rowan-m
Copy link
Contributor

rowan-m commented Nov 8, 2015

The Curl class is a wrapper for the curl_* functions, the actual request method is the CurlPost class. However, this is not particularly readable as shown by the confusion it's caused. I'll probably move these down into a lower namespace to make it clear it's a supporting class.

@rowan-m
Copy link
Contributor

rowan-m commented Jul 29, 2018

Closing super old issues. Please re-raise if still relevant.

@rowan-m rowan-m closed this as completed Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants