The reCAPTCHA shows up fine and the green box is ticked, but I still get "The answer you entered for the CAPTCHA was not correct." and when I check the CAPTCHA logs I am seeing a "The response parameter is missing." error.

Summary of resolution:
Read https://www.drupal.org/node/2476237 which details the known issue with the argument parameter settings
Upgrade to latest stable releases. Google fixed the issue in the library and it has been integrated into the latest release.
If the issues are still not solved, read https://www.drupal.org/node/2599804: class Drupal7Post receives "Network is unreachable". This are clearly issues with firewall or network. The only problem here is sub-optimal logging of the google library, detailed here https://github.com/google/recaptcha/issues/78.

Comments

phocks’s picture

Assigned: Unassigned » phocks
Status: Active » Fixed

I managed to fix this issue. I looked at the Drupal "Status Report" page and it said to remove the line "ini_set('arg_separator.output', '&');" from my settings.php and after that reCAPTCA worked perfectly!

hass’s picture

Assigned: phocks » Unassigned
Issue tags: -captcha, -recaptcha

Yep, that's it.

More info at Known issue with arg_separator.output

dtolj’s picture

I have the same problem in 7.x-2.0

"The answer you entered for the CAPTCHA was not correct."
Drupal logs show:
The json response is invalid or malformed.

hass’s picture

@dtolj: can you read?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bubu83’s picture

i have the same problem as dtolj on a fresh drupal 7 install, but in my settings.php there isn't the arg_separator.output line.

any ideas?

thanks

bubu83’s picture

Version: 6.x-2.0 » 7.x-2.0
Status: Closed (fixed) » Active
hass’s picture

Status: Active » Closed (fixed)

Read the docs, please. It can be a server setting, too.

bubu83’s picture

i've read it, i obtain always the error "The json response is invalid or malformed."

no arg_separator
cURL is enabled

so what can i do ?

thanks

matas.k’s picture

Status: Closed (fixed) » Active

Doesn't solve shit. None of this works on localhost (127.0.0.1) for "The json response is invalid or malformed." error

hass’s picture

Status: Active » Closed (fixed)

Debug the root cause and open a new case if you found it. Try dev.

jbiechele’s picture

I have the same strange problem like "bubu83" and "vibrasphere" receiving "The json response is invalid or malformed." I think this error message is miss leading.

I tracked it down to this problem in my case: class Drupal7Post receives the following response:

stdClass Object ( [code] => -101 [error] => Network is unreachable )

which leads to the strange error message.

Environment
- Drupal core 7.40
- reCaptcha 7.x-2.x-dev
- in settings.php there is NO ini_set('arg_separator.output', '&');
- in php.ini is set: arg_separator.output= '&'
- PHP 5.5.9

Now, on my local environment it is working fine and Drupal7Post receives the correct response. On my development server I get the mentioned error. I double checked the reCaptcha key and secret settings, everything looks fine on both environments.

Seems it has to do with some other PHP configuration settings.
Any hint is highly appreciated in how to track this down further or solve it. Thank you.

jbiechele’s picture

Just a quick note: my problem resulted from a firewall setting on the ISP side.
May be this could help anybody else with a similar problem.

drupal-son’s picture

Same issue.
I'm running the site on Pantheon.
I can't change the php.ini.
My settings.php there isn't any of those lines.
Adding ini_set('arg_separator.output', '&'); to my settings.php solve the issue.

Thanks.

carroll_webprog’s picture

Hello, I was also getting the same error as bubu83. I was able to solve this by enabling OpenSSL in my php.ini file. I am running an https site and the drupal_http_request was failing because openssl was not enabled. I am on a windows server, so I un-commented the line: extension=php_openssl.dll

Then I had to restart my server (Apache 2.4) and recaptcha subsequently started working.

albionbrown’s picture

This may or may not fix the JSON issues but it's worth a shot. Try adding you virtual host names that you use for dev environments into the list of domains for ReCAPTCHA on Google.

hass’s picture

What JSON issues? There is a follow up to catch the errors better #2599804: class Drupal7Post receives "Network is unreachable". You can help by writing the code.

crystaldawn’s picture

Status: Closed (fixed) » Active

Obviously this is a bug in the application. It's not catching incorrect settings. Simply telling people to set this or that is NOT the correct "fix" even if it does "fix" the issue. The correct fix is to WARN the person that a setting is incorrect. This is what Drupal "status" page is suppose to be used for. Please use it. Otherwise you'll continually have people re-opening this issue as you've already seen.

Please add a drupal status page check for the arg_separator.output setting with ini_get() function. That will put a close to this bug report which is completely valid. I see another issue with this problem as well linked above but its description is not sufficient enough to point users there. Marking as duplicate rather than closing, but the fix to this issue remains the same, a check needs to happen with ini_get() and reported in drupal status.

crystaldawn’s picture

Status: Active » Closed (duplicate)

Duplicate of https://www.drupal.org/node/2476237 EDIT: this url is a document page, not an issue :/

crystaldawn’s picture

Status: Closed (duplicate) » Active

Hmm I pre-maturely closed this as a duplicate, the page referenced was NOT an issue but a simple doc page. That means this issue should remain open until the underlying issue is fixed. Doh.

hass’s picture

Status: Active » Closed (fixed)

Bullsh**

crystaldawn’s picture

Status: Closed (fixed) » Active

Your attitude is terrible. Reported. This is a perfectly valid bug report. If the module requires something and it's not detecting that requirement, it needs to be tracked in an issue queue item until a fix comes along. This is a simple 1 liner fix so I dont know why there is a problem with it being an issue.

hass’s picture

Status: Active » Closed (fixed)

Do not re-open cases you have not understood, please. All you have written is incorrect.

crystaldawn’s picture

Currently as I see it, the module does try to detect things but in certain instances those checks are insufficient. Is this a case of the developer not being able to replicate the problem? I do not believe you have stated that fact yet. I have seen such instances and can easily reproduce the issue if thats what needs to happen.

commonColby’s picture

Status: Closed (fixed) » Needs work

Steps to reproduce:
1. Navigate to page with reCAPTCHA enabled form.
2. Fill out form to include the reCAPTCHA.
3. Submit form

Results:
- Before submission the CAPTCHA box shows a green check mark.
- Submitting the form shows a Drupal error "The answer you entered for the CAPTCHA was not correct."
- Submitting the form creates a watchdog error entry: The response parameter is missing.

The issue seems to be the the arrow should not be checked until parameters are all present. If something is missing it should not incorrectly show the arrow. Am I understanding this correctly? There is obviously a bug here, even if its an inaccurate error message.

Drupal 6.38

hass’s picture

Status: Needs work » Closed (fixed)

RTFM

crystaldawn’s picture

Hass has an issue with this issue (see previous rude comments above) in that he thinks it's a non-issue when in fact, it is an issue (say that 3 times fast lol). The problem is that it does not notify you of a configuration modification that needs to take place in settings.php. Well. Technically it "does" but it's buried in the status page, which truthfully is not the only place where it should give notice. Many people simply will not look there because the error that it DOES give, has absolutely nothing at all to do with the actual problem. If you look at the "status" page, it "should" say that you need to comment out the ampersand. BUT, it does not always say this. I had the exact same issue whereby the status page did NOT report this as needing to be commented out. I did not realize this until I started reading this issue queue and someone mentioned the need to comment it out for D6 installs.

What causes it to fail to recognize this, IDK. But I've had it happen and so have many others.

dandaman’s picture

It is deceiving that it seems to say that "all is well" with the green check but then on submission it says another story. But that's not really easy to solve as the green check is just between your browser and Google but the submission is Drupal/your web server asking Google if the CAPTCHA was successful, and if you're getting to this issue, some part of that second validation is not going well.

There seems to be a number of issues people have seen when getting this message:

Issue 1: Some part of the JSON request/response parsing is not working right on their server. It likely depends on how their server stack works, but some had to unset the arg_separator.output setting in their php.ini file or somewhere in their site config include ini_set('arg_separator.output', '&'); .

Issue 2: reCAPTCHA is actually not returning a response. Maybe check your reCAPTCHA account settings or your hosting provider's firewall settings to make sure something is not getting blocked.

With neither of these issues, there is no known way to reproduce them on any given Drupal install. If the issue can be more reproducable, then maybe some code can be added to document the issue. The issue is pretty apparent if you ever try to submit any form with the CAPTCHA on it, which should be one of the first steps in deploying the module on a site after configuring it.

For these reasons, I expect, hass closed the issue. If someone has more details on how to reproduce it on any site and/or a patch they've used to solve it and then some test the patch, I'm sure hass or another maintainer of reCAPTCHA will consider the issue and committing a fix for it.

In my case, on the Pantheon-hosted site, the arg_separator.output was set to &, but once I added ini_set('arg_separator.output', '&'); to my settings.php, now it works.

kaizerking’s picture

I am also getting the same error reCAPTCHA isnti working

raycascella’s picture

Status: Closed (fixed) » Active

I'm reopening this, as it is not "Fixed" as the status claims.

This does not appear to be a configuration issue, since many people have setup and used the module without ever having that configuration setting enabled. The company I work for is seeing this issue currently and we have multiple clients using Recaptcha, and we have never needed to modify our settings.php file. Most of our clients sites are working fine, however a handful are showing errors "The json response is invalid or malformed.". Which is an issue with either, the data being sent, or how it is being parsed.

If arg_separator was a required configuration case the module would immediately not work. The configuration is more of a stop-gap solution, to allow time to investigate why the json is being mangled at seemingly random, transient times.

hass’s picture

Status: Active » Fixed

Sounds like there are some misunderstandings. Please follow below instructions.

  1. Read https://www.drupal.org/node/2476237
  2. Upgrade to latest stable releases. Google fixed the issue in the library and it has been integrated into the latest release.
  3. If the issues are still not solved, read #2599804: class Drupal7Post receives "Network is unreachable". This are clearly issues with firewall or network. The only problem here is suboptimal logging of the google library. You can help writing the code or sponsor me to write it for you.

None of this issues is a fault or an issue with the recaptcha module. I hope this helps finding your network / firewall issues.

raycascella’s picture

Issue summary: View changes

Thanks for the clarification Hass, I've updated the issue summary to help people figure out what's going on a little faster =-D

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

manjiri.limaye’s picture

Component: reCAPTCHA Captcha » General

Hello,

I am also facing the same issue. I implemented the reCaptcha on DEV server, it worked fine. Later on I implemented the reCaptcha on UAT server and I am unable to get the response. There is a tick mark on the captcha but the form is not submitted.
I tried options specified above but none of it worked for me.

Did anyone face any such issue?

albionbrown’s picture

@manjiri.limaye What does your DB log say? I've had the same issue with reCAPTCHA recently and tried to debug with xdebug and it ended up being Google just evaluating the user incorrectly. Was fine the next day. Have you also added the UAT domain to CAPTCHA config on your google account?

japo32’s picture

@joshbrown81 did you have to do anything to fix the issue? I've added our UAT to the captcha config on our Google account but still get the issue.

albionbrown’s picture

@japo32 no I don't think I ever did anything in the end to fix it. We thought it may have been something wrong with Google's services as it did just seem to fix itself overnight and we haven't had an issue since.

japo32’s picture

@joshbrown81, Thanks.

It still didn't work the last time I checked unfortunately. Maybe it needs more time to simmer. :)

iamfredrik’s picture

Please reopen this. The problem still persists with PHP 7.0.23. Downgrading to PHP 5.6.31 fixed the problem.

japo32’s picture

Update on my case, it still didn't work.

jackdaniel9’s picture

Same problem

jackdaniel9’s picture

Same problem