ZF-9531: Incorrect headers when used with other services.


I was using this after I ran akismet to check for spam and was getting errors. The problem was that headers set by akismet were not reset before recaptcha sent it's request. This can cause unexpected results or errors. What was actually happening in my instances is the Host header was not reset and the recaptcha server wouldn't respond to the incorrect domain.

I noticed this happening in 1.7.4 and it seemed to be a problem up until at least 1.10


@Rob I can have a look a this in a couple of days if it's an issue we want to fix. The issue might be present in ZendService_ReCaptcha as well. Shall I see if I can fix it?

Yes please!

Shall I do the commit(s) against trunk and then merge them into the release-1.11 branch? I haven't been doing any contributions in ZF1 for ages, so don't really remember the flow.

That's exactly right.

Commit to trunk and then merge to release-1.12 though!

Ah, sorry, typo. :) Will have a look at the issue sometime this week. I can have a look at the ZendService_ReCaptcha component as well and see if it has the same issue.

This commit should fix this issue:…

In the code below the call to $recaptcha->verify() failed even when the correct values where entered into the captcha. After the fix this snippet works as expected.

$akismet = new Zend_Service_Akismet($key, $url);
  // Some params

$recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey, null, null, $ip);

echo "";
echo $recaptcha;
echo "";

if (!empty($_POST)) {