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
Comment #1
phocks commentedI 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!
Comment #2
hass commentedYep, that's it.
More info at Known issue with arg_separator.output
Comment #3
dtolj commentedI 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.
Comment #4
hass commented@dtolj: can you read?
Comment #6
bubu83 commentedi 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
Comment #7
bubu83 commentedComment #8
hass commentedRead the docs, please. It can be a server setting, too.
Comment #9
bubu83 commentedi'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
Comment #10
matas.k commentedDoesn't solve shit. None of this works on localhost (127.0.0.1) for "The json response is invalid or malformed." error
Comment #11
hass commentedDebug the root cause and open a new case if you found it. Try dev.
Comment #12
jbiechele commentedI 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:
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.
Comment #13
jbiechele commentedJust 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.
Comment #14
drupal-son commentedSame 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.
Comment #15
carroll_webprog commentedHello, 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.
Comment #16
albionbrown commentedThis 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.
Comment #17
hass commentedWhat 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.
Comment #18
crystaldawn commentedObviously 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.
Comment #19
crystaldawn commentedDuplicate of https://www.drupal.org/node/2476237 EDIT: this url is a document page, not an issue :/
Comment #20
crystaldawn commentedHmm 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.
Comment #21
hass commentedBullsh**
Comment #22
crystaldawn commentedYour 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.
Comment #23
hass commentedDo not re-open cases you have not understood, please. All you have written is incorrect.
Comment #24
crystaldawn commentedCurrently 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.
Comment #25
commonColby commentedSteps 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
Comment #26
hass commentedRTFM
Comment #27
crystaldawn commentedHass 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.
Comment #28
dandaman commentedIt 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.outputsetting in theirphp.inifile or somewhere in their site config includeini_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.outputwas set to&, but once I addedini_set('arg_separator.output', '&');to my settings.php, now it works.Comment #29
kaizerking commentedI am also getting the same error reCAPTCHA isnti working
Comment #30
raycascellaI'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.
Comment #31
hass commentedSounds like there are some misunderstandings. Please follow below instructions.
None of this issues is a fault or an issue with the recaptcha module. I hope this helps finding your network / firewall issues.
Comment #32
raycascellaThanks for the clarification Hass, I've updated the issue summary to help people figure out what's going on a little faster =-D
Comment #34
manjiri.limaye commentedHello,
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?
Comment #35
albionbrown commented@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?
Comment #36
japo32 commented@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.
Comment #37
albionbrown commented@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.
Comment #38
japo32 commented@joshbrown81, Thanks.
It still didn't work the last time I checked unfortunately. Maybe it needs more time to simmer. :)
Comment #39
iamfredrik commentedPlease reopen this. The problem still persists with PHP 7.0.23. Downgrading to PHP 5.6.31 fixed the problem.
Comment #40
japo32 commentedUpdate on my case, it still didn't work.
Comment #41
jackdaniel9 commentedSame problem
Comment #42
jackdaniel9 commentedSame problem