I'm running the Amasty Invisible Captcha extension in Magento 1.7.x and keep getting 'Something is wrong'.

Tracking this down the extension gets an error when it tries to use getBody to read the response. It appears that Zend_Http_Response Object indicates that the response is chunked, but in reality it is not

`2018-05-25T19:32:56+00:00 DEBUG (7): Zend_Http_Response Object
    [version:protected] => 1.1
    [code:protected] => 200
    [message:protected] => OK
    [headers:protected] => Array
            [Content-type] => application/json; charset=utf-8
            [Content-encoding] => gzip
            [Date] => Fri, 25 May 2018 19:32:56 GMT
            [Expires] => Fri, 25 May 2018 19:32:56 GMT
            [Cache-control] => private, max-age=0
            [X-content-type-options] => nosniff
            [X-xss-protection] => 1; mode=block
            [Server] => GSE
            [Alt-svc] => hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35"
            [Connection] => close
            [Transfer-encoding] => chunked

    [body:protected] => ¬��1
�  нSȟS��s4���'#SHE$�{��xOC��5���;a[Ie-��Xx׏� �������0-�O�Ct�ºr��`�T�� 

I had to change from

if (!empty($googleResponse) && array_key_exists('success', $answer = json_decode($googleResponse->getBody()))) {


if (!empty($googleResponse) && array_key_exists('success', $answer = json_decode(gzdecode($googleResponse->getRawBody())))) {

Has anyone else seen this? Amasty suggested I either pay them $59 or post here, so I chose the latter...

  • You solved your own issue! Best make an answer out of it. I'd do a check on the content-encoding header, see if the content isgzipped. If so, use your version, otherwise default to their own. That way if you ever decide to change your server settings things will continue working. You might also inform Amasty of what you did and maybe they'll incorporate it into a later version of the module. – Rian May 29 '18 at 14:08
  • Hi Rian, I did tell Amast what I had to do to fix it and they didn't seem interested at all, instead they said post here on stackexchange… Just seems odd to me that I'm the only one who's had this issue... I don't think I control whether the Zend response object says it is chunked, so presume that comes from Google or from the standard framework – Twan van Beers May 30 '18 at 13:46
  • Yeah, I read what you said about Amasty in the original post, perhaps they stopped supporting the module. And no you don't control if the response object says its chunked or not, but the gzip in the Content-encoding header gives it away I believe. If you write an answer and clearly describe what you did and where someone else who runs into this might be able to benefit from it :) – Rian May 30 '18 at 14:19

Browse other questions tagged or ask your own question.